I've been looking at the REST API to update fields in SharePoint. I can get it to update the title without any problems, however when I go to update the SharedWithUsersId they do not update. I don't get any errors or success messages when running an update. This is the JSON I am posting to the service:

    "__metadata": {
        "type": "SP.Data.DocumentsItem"
    "Title": "Default Value",
    "SharedWithUsersId": {
        "__metadata": {
            "type": "Collection(Edm.Int32)"
        "results": [

Am I missing something or is it even possible? The credentials being passed are for a Global Administrator which has access to the library.


After digging a little deeper this is how you can share an item.


Sharing a file can be done like so, also a folder as this can be treated as an item

/_api/Web/Lists(guid'guid of list')/Items(4)/roleassignments/addroleassignment(principalid=1,roledefid=1073741827)

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.