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

I have a requirement to grant a department contribute to their department parent & child sites. The catch is, they also want to be able to grant & remove contribute to outside department users. If I were to create a field called "Contribute Members" to a list on a site, could I have an event receiver grant/remove AD users contribute when the form is saved?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Of course, you could.

Some key articles for you to start with:

  1. SPSecurity.RunWithElevatedPrivilegies - this will allow you to elevate privilegies for current user
  2. SPFieldUserValue and SPFieldUserValueCollection - these classes will help you to extract values from "Person or group" column.
  3. SPWeb.EnsureUser method - will help you to ensure that AD user is added to a site
  4. SPGroup.AddUser method - will allow you to add users to SharePoint groups of a site, providing appropriate privilegies to them

Feel free to ask, if you need more details for any step.

share|improve this answer

That is one of the common uses of Event Receivers : to take actions the users themselves might not be able to do due to UI or security restrictions.

share|improve this answer
    
sounds great in theory, right! –  JR_ATLDev Apr 29 '11 at 17:49

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.