0

I want to know how I can add a Guest Reader site user on my OneDrive. Since a Guest Reader is for a particular file, I want to know if I can add such a user through REST API. I am looking for something like

https://{mysite URL}/_api/Web/siteusers

Method POST

Body

{ '__metadata': { 'type': 'SP.User' }, 'LoginName':'SHAREPOINT\\reader_blabla'}

where blabla is the UniqueId of my file (with dashes removed)

Content-Type

application/json;odata=verbose

Accept

application/json;odata=verbose

Response

{
"error": {
    "code": "-2130575276, Microsoft.SharePoint.SPException",
    "message": {
        "lang": "en-US",
        "value": "The user does not exist or is not unique."
    }
}
}

I have read here that you can add site users to sitegroups, so lets say if I do as the instructions say, I have a limited access group with id 14

https://{mysite URL}/_api/Web/sitegroups(14)/users

The body and headers are the same. Still I get the same error. What am I doing wrong?

  • Does your user exist in O365? – wjervis Feb 23 '15 at 15:33
  • No, I believe guest users (Guest Reader/Writer users) are site users and not O365 users (since their userId is null) – Syed Mauze Rehan Feb 23 '15 at 15:34

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.