2

The code am using:

pnp.sp.web.getFolderByServerRelativeUrl("Shared%20Documents").files.getByName("test.jpg").getItem().then(item => {

      item.update({
          Title: "A Title",
          tag2: "My Other Value"
      });
    })

error : The property 'tag2' does not exist on type 'SP.Data.Shared_x0020_DocumentsItem'. Make sure to only use property names that are defined by the type.

NOTE: INTERNAL NAME DOES NOT WORK TOO!

7
  • do you have the column with internal name "tag2" in that document library? Dec 11, 2018 at 5:33
  • @GaneshSanap yes i tried with the internal name ,it doesn't work Dec 11, 2018 at 5:45
  • Try giving the url to library like this getFolderByServerRelativeUrl("/sites/mysite/Shared%20Documents") Dec 11, 2018 at 5:47
  • @AnkitKatiyar doesn't work too Dec 11, 2018 at 5:51
  • Before updating the item check if the get request is working from the same code.' Dec 11, 2018 at 5:54

1 Answer 1

2

I finally figured out the issue,i was using the wrong internal name. what i did was to go library setting-->select column-->Have a look at the link and look for field=something.

This was the wrong way of looking for the internal name. The correct way was

var item =pnp.sp.web.getFolderByServerRelativeUrl("Shared%20Documents").files.getByName("test.jpg")

console.log(item)

You then consult the body of item to identify the correct internal name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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