0

I created a button in sharepoint site using content Editor,when the current users click on the button he must have to add to that particular group,can any one give example how to add current users to group using SPServices?

  • Did you mean that there's a group that current user is not yet a member of (neither explicitly, nor via domain groups) and you want this button to allow the users to add themselves to the group? – Alexey Krasheninnikov Oct 9 '14 at 8:41
3

You could use AddUserToGroup operation for that purpose, for example:

$().SPServices({
    operation: "AddUserToGroup",
    groupName: groupName,
    userLoginName: userLoginName,
    completefunc: function(data,status){
       //... 
    }
}); 

References

Managing SharePoint Site User Memberships in Multiple Groups Using SPServices

0

If I understand the question correctly, SPServices or any other client-side development is not the way to go.

Better use out-of-the-box settings of the group to allow any users to view membership and auto-accept requests for joining and leaving the group if that's appropriate for the group.

Then simply provide a hyperlink to the group's page (.../_layouts/people.aspx?MembershipGroupId=...) where an out-of-the-box button to Join will be available.

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.