Udostępnij za pośrednictwem


Setsitelock: Stsadm operation (Office SharePoint Server)

Applies To: Office SharePoint Server 2007

This Office product will reach end of support on October 10, 2017. To stay supported, you will need to upgrade. For more information, see , Resources to help you upgrade your Office 2007 servers and clients.

 

Topic Last Modified: 2015-03-09

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

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 name Value Required? 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 https://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 https://server_name -lock noaccess

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

stsadm -o backup -url https://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 https://server_name -lock none