December 2013 - Posts

Getting the domain\user when using versionControl.GetPermissions() in the TFS API
Fri, Dec 20 2013 9:40

 

If you are using the TFS API to get a list of user who have rights in a given version control folder you need to be careful as you don’t get back the domain\user name you might expect from the GetPermissions(..) call. You actually get the display name. Now that might be fine for you but I needed the domain\user format as I was trying to populate a peoplepicker control.

The answer is you need to make a second call to the TFS IIdentityManagementService  to get the name in the form you want.

This might not be best code, but shows the steps required

private List<string> GetUserWithAccessToFolder(IIdentityManagementService ims, VersionControlServer versionControl, string path)
{
    var users = new List<string>();
    var perms = versionControl.GetPermissions(new string[] { path }, RecursionType.None);
    foreach (var perm in perms)
    {
        foreach (var entry in perm.Entries)
        {
                var userIdentity = ims.ReadIdentity(IdentitySearchFactor.DisplayName,
                                                        entry.IdentityName,
                                                        MembershipQuery.None,
                                                        ReadIdentityOptions.IncludeReadFromSource);

                users.Add(userIdentity.UniqueName);
          }
    }

    return users;
}

Notes from my session of the Visual Studio 2013 launch at NDC London
Wed, Dec 4 2013 15:14

Thanks to anyone who came to my session ‘TFS is not just for Visual Studio users’ at the Visual Studio 2013 at NDC London yesterday. Hope you found it useful and are now thinking of TFS as a tool for heterogeneous teams, not just developers using Visual Studio. As I discussed there are many options:

  • Developers can work within their IDEs
    • Visual Studio 2008, 2010, 2012, 2013
    • Any IDE based on Eclipse
    • Any IDE using MSSCCI (VB6, VS2003, VS2005, MathLab, Enterprise Architect)
  • If not using an IDE can check code in and out  from
    • The command line (.NET and Java)
    • API (.NET and Java) and REST for your own third party developed tools (or from within PowerShell by loading the .NET API assemblies)
    • Windows Explorer Integration allows a checkin and out from Windows Explorer, great for graphics designer’s tools or IDEs with no source control integration
  • You can manage work items from
    • Within Microsoft Office, Excel and Project (2010-2013) – good for batch operations and general project manager activities.
    • But probably a web browsers will be the primary tool for most people, whether on a PC, Mac or tablet
  • Also if you are using a Git repository in your Team Project there are a while range of GIT clients for various platforms all of them will work

The links from my last slide of suggestions were

by But it works on my PC!
Filed under: