Question

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

Était-ce utile?

La solution

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.

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top