Looking for something?

I bumped into a strange problem today. It wasn’t hard to solve, but worth mentioning.

To manually enable the option to request permissions to the site, you do this from Site Actions – Site Settings – Advanced Permissions – Settings – Access Request.
From that page you can specify if users should be able to request permissions to the site, and who should receive the email.

RequestAccessEnabled via code instead

No worries so far, but this time I had to do this through code upon dynamically creating a new site. This means that we need to speak to the object model in order to get things right…

When you consult MSDN, it clearly states that this property ( web.RequestAccessEnabled ) is a get/set property which you can get or set via code. However this is not the case. It’s a get-only property which means that you can’t really use it to enable access requests.

This is simply solved by using the somewhat similar property called RequestAccessEmail. So, if you do web.RequestAccessEmail =

tobias at zimmergren dot net

; you’re automatically enabling the request access for that site.

Now your users can simply see the "Request Permissions" link in order to submit a request to the specified email-address in order to join the site.

(Just a tip to those of you who read MSDN and tried to follow it blindly ;)

Have a good day.

0 Comments 09 April 2008
Tobias Zimmergren

Tobias Zimmergren

Hi, I'm Tobias. I am a Microsoft MVP for SharePoint and I use this site to share my thoughts on tech with you on topics like SharePoint, Office 365, Azure and general web development.

  Malmö, Sweden

Related Post

Comments powered by Disqus
res.