Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In my scenario we want to customize the access request page. We already know how to create an application page, and with a powershell command, instruct sharepoint to use that page instead. http://blogs.msdn.com/b/ramg/archive/2009/11/06/supported-way-of-replacing-application-pages-in-layouts-directory.aspx

When the user gets to that page he will be able to send a custom message to the person responsible, the custom app page we are creating will also put access requests on a custom list.

When the admin checks the custom list, there will be an Approve and Reject buttons for each item in the list.

The questions is how to approve programatically an access request?

share|improve this question
    
or at least how to set the permission to a site by code? –  L.V. Sharepoint Architect Feb 10 '12 at 10:25

1 Answer 1

up vote 1 down vote accepted

If my understanding is correct, you may want to add the user who created the request into a SharePoint group so that he gets the permission automatically. the code for that look something like:

string login = "UserName";
string groupName = "Group";
SPUser user = SPContext.Current.Web.EnsureUser(login);
SPGroup group = SPContext.Current.Web.Groups[groupName];
group.AddUser(user);
share|improve this answer
    
how to do the same using Client Object Model? –  user2728700 Nov 19 '13 at 5:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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