SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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? – Esteban V Feb 10 '12 at 10:25
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];
share|improve this answer
how to do the same using Client Object Model? – user2728700 Nov 19 '13 at 5:42

Your Answer


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.