Setsitelock: Stsadm operation (Office SharePoint Server)

Updated: 2009-04-28

Description

Sets a value that specifies whether the site collection is locked and unavailable for read or write access. This operation should be used in conjunction with the Getsitelock operation. For more information, see the Examples section.

Important Important:

In Service Pack 2 for SharePoint Products and Technologies, site collections are automatically locked as read-only before a backup process occurs. Therefore, there is no need to use the Setsitelock: Stsadm operation (Office SharePoint Server) operation. If you do not want site collections to be locked as read-only, you must specify the nositelock parameter of the Backup: Stsadm operation (Office SharePoint Server) operation that is available in Microsoft Office SharePoint Server 2007 with Service Pack 2 (SP2).

Syntax

stsadm -o setsitelock

   -url <URL name>

   -lock {none | noadditions | readonly | noaccess}

Parameters

Parameter nameValueRequired?Description

url

A valid URL, such as http://server_name

Yes

The URL of the site collection.

lock

Any of the following values:

  • None: Sets the site collection to unlock.

  • Noadditions: Permits changes that reduce the size of the data.

    For example, if you had an announcement list item whose body consisted of 50 characters, you could successfully edit the list item so that the body was reduced to 25 characters. However, if you tried to edit the list item so that they body was increased to 100 characters, that would be blocked.

  • Readonly: Sets the site collection to read-only.

  • Noaccess: Sets the site collection unavailable to all users.

Yes

Set the lock status of the site collection.

Examples

A common situation where the getsitelock and setsitelock operations are useful is when a site is backed up. Typically, before you back up a site collection, the site should be locked and no users should have access to it.

To determine the lock status of the site, you can use the following getsitelock syntax:

stsadm -o getsitelock -url http://server_name

Once the lock status of the site collection is determined, you can use the noaccess parameter of the setsitelock operation to lock out all users to the site:

stsadm -o setsitelock -url http://server_name -lock noaccess

You can use the Backup operation to create a backup of the site collection:

stsadm -o backup -url http://server_name -filename "filename.bak" -overwrite

After the site has been backed up, you can use the none parameter of the setsitelock operation to remove all locks to the site:

stsadm -o setsitelock -url http://server_name -lock none

Tags :


Community Content

dudeJoe
export and sitelock

When using export rather than backup, it appears that the noaccess lock is too restrictive and the export command cannot execute. I used sitelock readonly instead. That seemed to work fine for the export.
But careful, the import then failed with an error message indicating that a certain parent web not being present.
Conclusion: sitelock cannot be used with export.

Tags :

Page view tracker