|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Lock and Unlock Folders or Files
A folder or file can be locked or unlocked to deny or restore the user's privileges. Privileges include checking out an item for edit into a different workspace or checking into an item from a different workspace. For more information, see .
You can use a lock to temporarily freeze the server version of an item so that you can check in a pending change without having to resolve any merge conflicts. If you want to permanently prevent access to an item on the server, you should use the instead.
To perform these procedures, you must have the Lock permission set to Allow. For more information, see.
To lock a folder or file from Source Control Explorer
On the View menu, click Other Windows and then click Source Control Explorer.
You can also double-click Source Control in Team Explorer.
In Source Control Explorer, go within a workspace to the folder or file that you want to apply a lock to, right-click, and then click Lock.
In the Lock dialog box select file or folder you want.
Click either the Check Out lock, or the Check In lock type, and then click Lock. For more information, see.
Under Pending Changes, Source Control Explorer displays the status of lock. The next time pending changes are checked in, the lock will take affect. For more information, see .
You can also lock folders and files from the command line, for more information, see.
To unlock a folder or file from Source Control Explorer
On the View menu, click Other Windows and then Source Control Explorer.
In Source Control Explorer, go to the folder or file that you want to remove a lock from, right-click and then click Unlock.