5

I don't understand the response for the API call:

/_api/web/getFileByServerRelativeURL('/docs/Test.docx')/ListItemAllFields/SharedWithUsersId

I upload a Test.docx document and share it with two users.

The above rest call returns something like

{
  "odata.metadata": "http://.../_api/$metadata#Collection(Edm.Int31)",
  "value": [
    6,
    15
  ]
}

I open the share dialog in the web interface and share the document with one more user. I then get a response like:

{
  "odata.metadata": "http://.../_api/$metadata#Collection(Edm.Int31)",
  "value": [
    6,
    15,
    25    <---- User just added
  ]
}

as expected.

I open the share dialog again and remove the user that I just added. After this the response is still:

{
  "odata.metadata": "http://.../_api/$metadata#Collection(Edm.Int31)",
  "value": [
    6,
    15,
    25    <---- User has been removed from share list
  ]
}

It looks like SharedWithUsersId contains all user ids that the document has ever been shared with.

Is this the expected behavior?! Is this particular endpoint documented somewhere?

Your Answer

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

Browse other questions tagged or ask your own question.