Programmatically access User permissions for web application in sharepoint 2010 -


i trying access user permissions > create subsite enable/disable feature sharepoint api. how access user permission webapplications?

if go ca in sharepoint 2010 , click on web application , choose user permission in ribbon shows lot of check boxes. under site permission there option create subsites. looking for.

based on ref: toggle permission in webapplication.rightsmask)

powershell:

$webapp = get-spwebapplication -identity http://mywebapp $allowsubsites = $false   $newpermissions=$null    if ($allowsubsites){     $newpermissions=[microsoft.sharepoint.spbasepermissions]($webapp.rightsmask -bor [microsoft.sharepoint.spbasepermissions]::managesubwebs) } else {     $newpermissions=[microsoft.sharepoint.spbasepermissions]($webapp.rightsmask -band [system.int64](-bnot ([microsoft.sharepoint.spbasepermissions]::emptymask -bor [microsoft.sharepoint.spbasepermissions]::managesubwebs))) }  $webapp.rightsmask = $newpermissions $webapp.update() 

c#:

   spwebapplication application = sourcesite.webapplication;    application.rightsmask = application.rightsmask | spbasepermissions.managesubwebs;    application.update(); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -