Posted by : Alon Havivi Friday, October 16, 2009

SPUser

user = SPContext.Current.Web.CurrentUser;
//NOTE: The account which runs the application pool needs to be a farm administrator
SPSecurity.RunWithElevatedPrivileges(delegate()
{

using (SPSite site = new SPSite("Your Site Utl"))

   {

     site.WebApplication.FormDigestSettings.Enabled = false;
     site.AllowUnsafeUpdates = true;
     site.WriteLocked = false;
     site.ReadOnly = false;
     site.LockIssue = "The site was disabled by: " + user.Name + " (e-mail: " + user.Email + ")";
     site.ReadLocked = true;

   }

});

One Response so far.

  1. Sri says:

    Hi alon.

    Thanks for the detailed explainantion. But i am checking thro object model is it possible to set the Readonly property to false(Assumption site has been locked)

Popular Post

- Copyright © Alon Havivi's Blog -