VersionControlServer.GetPermissions Method (String, String, RecursionType)
Gets all the permissions for one or more items in the Team Foundation Server database, for the specified users or groups. The permissions are returned in a string form for easier user display. It is not possible to parse or union these permissions to find a user's permissions 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 permissions that are granted for this user.
Assembly: Microsoft.TeamFoundation.VersionControl.Client (in Microsoft.TeamFoundation.VersionControl.Client.dll)
public ItemSecurity GetPermissions( string identityNames, string items, RecursionType recursion )
- Type: System.String
The user or group names for which you want to get permissions.
Pass null to match all users and groups who have permissions set for these items.
- 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 ValueType: 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.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.