1

I have written code to upload the file in SharePoint online .. but while upload the page gets refreshed .. Please help .

Code -

   sp.web
      .getFolderByServerRelativeUrl("Student%20Details%20No%20Content%20Type")
      .files.add(fileContent.name, fileContent, true)
      .then(f => {
        f.file.getItem().then(item => {
          item.update({
            Title: "A Title",
            Description: "My Other Value"
          });
        });
      });

Now getting error -

Uncaught (in promise) Error: Error making HttpClient request in queryable [400] ::> {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The property 'Description' does not exist on type 'SP.Data.Student_x0020_Details_x0020_No_x0020_Content_x0020_TypeItem'. Make sure to only use property names that are defined by the type."}}} at new HttpRequestErr

3

Looks likely that your document library does not have a Description field, i.e. a field with the internal name "Description". PnP wants you to specify the internal name, not the display name of the fields to set.

Does the field perhaps have a different internal name and only the display name is "Description"? Try checking by going into the List Settings page and clicking on your "Description" field - in the address bar, there is a "&Field=XY" parameter, where XY is your (encoded) internal name of the field.

  • Thank you . I have document library with content type . How to upload document library with .. content type metadata ? Please help . – BISWANATH HALDER Feb 1 at 6:09
  • I currently don't have a possibility to test it, but did you try either setting a property "ContentType" or "ContentTypeId" to the unique ID of the Content Type (which has a form similar to 0x010100XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)? – Anon Feb 1 at 8:52
  • Can you please provide reference for the same .. please help – BISWANATH HALDER Mar 4 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.