First published on TECHNET on Aug 28, 2013
This post is a contribution from Raghavendra B Nanjaiah, an engineer with the SharePoint Developer Support team.
Problem
When you try to add users through the UserGroup.asmx web service (http://localhost/_vti_bin/UserGroup.asmx) in SharePoint 2013 with the sample code below.
usrgrpService.Credentials = new System.Net.NetworkCredential("Administrator", "access", "contoso");
usrgrpService.AddUserToGroup("Dev Members", "usera",
"contoso\\usera", "usera@contoso.com", "Notes");
You will successfully add user to the SharePoint group, but if you look at the user permission or try accessing site using this user credentials, you’ll get “Site is not shared with you” message.
Solution
You have to pass user in claims encoded format (e.g., i:0#.w|contoso\chris ) in SharePoint 2013. This is because claims authentication is enabled in the web applications you create by default.
Not that this is something that many don’t know, but we’ve had customers reporting this issue to us and we thought we’ll get this message out!
HTH
Welcome to the SharePoint Blog! Learn best practices, news, and trends directly from the SharePoint team.