RemoveUserCollectionFromGroup

Dec 21, 2010 at 10:11 PM

I used SPServices to create a SharePoint Group dynamically from a list item.  Check!

I then run a SharePoint Workflow that creates a series of 'child' list items related to the first item.  Check!

On just one of those 'child' items, [Title=Team Selection], I used a Contact list lookup to select "Team members" for the list item, (19 different fields0.  Check!

When the list item is saved I perform a PreSaveAction to cycle through each "Team member" column, grab the user login, company name and a few other columns from the Contacts list and update fields on the list item.  Check!

After finishing that task, the PreSaveAction also adds each "Team member" to the SharePoint Group that I created on the parent list item. Check!

The situation I am running into is that if I update the "Team member" columns at any time, the new Contact gets added to the SharePoint Group but the old Contact does not get removed. 

I considered about using GetUserCollectionFromGroup to aquired the list of users in my SharePoint Group and then cycle through each entry with RemoveUserFromGroup but I am a little concerned about save conflicts.  I am on a tight schedule, but so I may have to go that route to

I was looking through the offical list of web services and found RemoveUserCollectionFromGroup and was hoping that Mark would have a suggestion for an alternative, or perhaps consider adding it to the SPServices in a future release.

Any thoughts out there?

 

 

Coordinator
Dec 23, 2010 at 4:43 PM

Sorry, I missed your post on Tuesday because the email alert went into spam for some reason.

Looks like I missed the RemoveUserCollectionFromGroup operation. I can add it in the next release, but it sounds like you are on a deadline.

If you're comfortable editing SPServices yourself, it isn't that hard to add a new operation. (I really need to do a blog post on how to do this.) Or, I could also do a patched version of v0.5.8 for you.

M.

Dec 23, 2010 at 11:53 PM

Marc,

 

No worries.  Updating SPServices isn't a bad idea, but I hate using one-off code on a production site, especially when I try to keep up-to-date on your releases.  I'm just happy to hear that it can be added to the next release.

Thanks for the updated info and the great library!  I have accomplished things with just SharePoint Designer 2007 and SPServices that I did not dream was possible.  Great work!

WCDjr

Coordinator
Dec 24, 2010 at 4:32 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Dec 28, 2010 at 3:57 AM

WCDjr:

I've added all of the remaining Users and Groups methods into v0.6.0ALPHA4. I'll update the docs soon, but the .js is posted in case you'd like to try it out. Lots of other changes coming in v0.6.0, too.

M.