2

I had successfully created sub sites using REST API and i set 'UseUniquePermissions': true so that i can manage selected users as a member into the site i created , Now i'm wondering how can add a certain user to be a member in my site using REST API.?

3

Two steps to do this.

Get your Group Name by its login name. Group is needed to add users in this group

/_api/web/sitegroups/GetByName('Your Group Name')

Now send a POST request in the following URL that will add your desired user to this group.

/_api/web/sitegroups('Group Id')/users

request body should be like following.

var data = {
    __metadata: {
        type: 'SP.User'
    },
    LoginName: 'Put here user login name'
}
  • or first i should create a group then add users on it..! copy.! cheers. – Looytawon Oct 14 '15 at 8:53

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.