Share via


ReadLocked Property

The ReadLocked property of the SPSite class gets or sets a Boolean value that specifies whether the site collection is locked and unavailable for Read access.

Property Value

true if the site collection is locked for Read access; otherwise, false.

Remarks

Getting the value of the ReadLocked property requires site collection administrator rights, while setting the value requires global administrator rights.

When a site collection is locked for reading, this property returns an error message stating that additions to the site have been blocked for requests made through the object model or through remote procedure call (RPC) protocol. For other HTTP requests, this property returns an HTTP 403 error stating that fulfilling the request is forbidden.

Example

The following code example applies a lock on writing but not on reading to a site collection.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.Administration namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security