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.

| improve this answer | |
  • Thank you . I have document library with content type . How to upload document library with .. content type metadata ? Please help . – BISWANATH HALDER Feb 1 '19 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 '19 at 8:52
  • Can you please provide reference for the same .. please help – BISWANATH HALDER Mar 4 '19 at 14:00
0

The Problem is on your field name which You passed here..Just creating new Document library then You will add new columns What You want and after you can give that exact field/column name without changing and then finally pass it in your code.

| improve this answer | |
New contributor
Ravina is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.