This documentation is archived and is not being maintained.

VersionControlServer.GetPermissions Method (String[], RecursionType)

Gets all the permissions for one or more items in the Team Foundation Server database. Permissions are returned not only for the user currently logged onto the server, but for all users and groups who have permissions set for these items. The permissions are returned in a string form for easier user display. It is not possible to parse or union these permissions to find out if a user has permissions set to an item, because a user's permissions depend on what groups they are a member of. You can use the GetEffectivePermissions method to find the permissions that are granted to a user.

Namespace:  Microsoft.TeamFoundation.VersionControl.Client
Assembly:  Microsoft.TeamFoundation.VersionControl.Client (in Microsoft.TeamFoundation.VersionControl.Client.dll)

public ItemSecurity[] GetPermissions(
	string[] items,
	RecursionType recursion


Type: System.String[]

The files or folders for which you want to get permissions. Each string may represent a Team Foundation Server path ($/CmdLine/parse.cs) or a local path (C:\Code\CmdLine\parse.cs), in the latter case, the local path is mapped to a server path via a workspace. If any string in the list is null, or refers to a deleted item or an old version of an item, an exception occurs.

Type: Microsoft.TeamFoundation.VersionControl.Client.RecursionType

The recursion parameter determines what files and folders you want to get. RecursionType.None examines the passed items only; if you passed in $/CmdLine then you will get permissions for the folder $/CmdLine. RecursionType.OneLevel examines the passed items and, in the case of folders, their children; if you passed in $/CmdLine you will get permissions for the files and folders directly inside that folder.

RecursionType.Full examines the full tree; if you passed in $/CmdLine/parser.cs you will get all files called parser.cs inside $/CmdLine or any folder under it.

Return Value

Type: Microsoft.TeamFoundation.VersionControl.Client.ItemSecurity[]
Each ItemSecurity object in the returned array contains a string that indicates what item it is ($/CmdLine): a Boolean variable that indicates whether this item inherits permission from its parent folders; a Boolean variable that indicates whether the current user has permission to set permissions on this item; and an array of AccessEntry objects. These objects will contain strings that indicate whether allow and deny permissions are set for different users. Each ItemSecurity object corresponds to one file or folder and each AccessEntry object refers to one user's permission to that item.