0

I am trying to create groups on a SharePoint 2010 site via the UserGroup.asmx web service. I am using jQuery and SPServices to interact with the web service.

When I try to create a group (via the AddGroup method) which is owned by a user it works fine:

groupName: "NewGroup",
ownerIdentifier: "UserOwner",
ownerType: "user"

When I specify another group as the owner I get a 400 error and a "Group cannot be found error":

groupName: "NewGroup",
ownerIdentifier: "GroupOwner",
ownerType: "group"

Using the same group name (GroupOwner) however, I can find it using the GetGroupInfo method of the UserGroups.asmx web service. I have also tried setting the ownerIdentifier to the ID of GroupOwner, which produced a 500 error.

Every example I can find of the AddGroup method only ever specifies users as ownerIdentifier.

I am at a loss at this point - does anyone have any suggestions as to either what I'm doing wrong or where I should be looking for more information?

2 Answers 2

1

This appears to be an error in my code. I was not properly escaping the name of GroupOwner. I was sending A&Z Group and I should have been sending A&Z Group.

Once I rectified that the new group was created with no problems.

0

You could try to use the ULS Viewier to aid you in debugging your problem.

But another options is to use Client Object Model to work with the groups, like this:

var ctx = new SP.ClientContext();
var group = new SP.GroupCreationInformation();
group.set_title('Test');
group.set_description('Oh hai');
ctx.get_web().get_siteGroups().add(group);
ctx.executeQueryAsync();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.