Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

WSS UserGroup WS error: Adding a user to a WSS subsite

  Asked By: Tucker    Date: Dec 03    Category: Sharepoint    Views: 1240

Based on what I've been able to find in the WSS SDK, the only way to programmatically and remotely add a user to site is to add them to a cross-site group using the UserGroup web service. The only method call is wsUserGroup.AddUserToGroup()which adds people to a cross-site group. There appear to be no WS methods for adding people to a subsite group.

On the surface, this appears to work fine but the user gets added to the cross-site group but the invitation email they receive is for the top-level site and not the subsite we want them to use (i.e. the site that allows XXXXXCommunityUsers to add to discussion lists, etc).

Here’s the code:

UserGroup wsUserGroup = new UserGroup();

//top-level site string urlUserGroupWS = "https://sharepointcentral.sharepointsite.com/_vti_bin/UserGroup.asmx";

//subsite string urlUserGroupWS = "https://sharepointcentral.sharepointsite.com/XXXX/_vti_bin/UserGroup.asmx";

string urlUserGroupWS = "https://sharepointcentral.sharepointsite.com/_vti_bin/UserGroup.asmx";

wsUserGroup.Url = urlUserGroupWS;
wsUserGroup.Credentials = crdSuperUsers.GetCredential(uriLists, "Digest");

string sFirstName = "Foo3";
string sLastName = "Foo33";
string sRequestedLoginName = "Foofoo3";
string userName = sFirstName + " " + sLastName + " (XXXXX Member)";
string userLoginName = "apptix\\" + sRequestedLoginName;
string userEmail = "foofoo3@...";
string userNotes = "XXXXX Member since " + dtNow.ToShortDateString();

string groupName = "XXXXXCommunityUsers";

//Add the specified user to the specified cross-site group
wsUserGroup.AddUserToGroup(groupName, userName, userLoginName, userEmail, userNotes);

The obvious change to make the code use the WS relative to the XXXXX subsite url :

string urlUserGroupWS = "https://sharepointcentral.sharepointsite.com/XXXXX/_vti_bin/UserGroup.asmx"

instead of the top-level site:

string urlUserGroupWS = "https://sharepointcentral.sharepointsite.com/_vti_bin/UserGroup.asmx";

But the web service fails with HTTP 404: Not found. Typing either URL into IE will display the user friendly version of the WSDL.

Other thoughts/workarounds?



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on WSS UserGroup WS error: Adding a user to a WSS subsite Or get search suggestion and latest updates.