Dela via


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 in Pending Changes to an item from a different workspace. For more information, see Create and work with workspaces.

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 Permission Command instead.

Tip

You can use the Lock command to remove another user’s lock if you have sufficient permissions.

Requirements

See Permission reference for Team Foundation Server.

To lock a folder or file from Source Control Explorer

  1. On the View menu, choose Other Windows,and then choose Source Control Explorer.

    You can also double-click Source Control in Team Explorer.

  2. In Source Control Explorer, in a workspace, open the shortcut menu for the folder or file to which you want to apply a lock, and then choose Lock.

  3. In the Lock dialog box select the file or folder you want.

  4. Choose either the Check Out lock or the Check In lock type, and then choose Lock.

    For more information, see Understand lock types.

    Under Pending Changes, Source Control Explorer displays the status: lock. The next time pending changes are checked in, the lock will take affect. For more information, see Check in your work to the team's codebase.

    Note

    You can also lock folders and files from the command line. For more information, see Lock Command.

To unlock a folder or file from Source Control Explorer

  1. On the View menu, choose Other Windows,and then choose Source Control Explorer.

  2. In Source Control Explorer, open the shortcut menu for the folder or file from which you want to remove a lock, and then choose Unlock.

See Also

Concepts

Understand lock types

Use Source Control Explorer to manage files under version control

Other Resources

Lock Command