TFS 2015 RTM, Update 1 : “TF14098: Access Denied: User needs Label permission(s) for .”

We’ve recently come across an issue with TFS 2015 RTM, where the CreateLabel() method would through an exception for one particular scenario. This was pointed out by one of our customers.

We were able to get a part of his code that’s failing,

private static void TFS_CreatelabelTest()
{

            TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("https://server:8080/tfs/DefaultCollection"));

            VersionControlServer vcs = tpc.GetService<VersionControlServer>();

            VersionControlLabel[] labels = vcs.QueryLabels("Test Label", "$/First/Sample", "", true);

         

 

            //Notice the “” for the folder path defining the scope of the label

            VersionControlLabel vcLabel = new VersionControlLabel(vcs, "LabTest_" + DateTime.Now.ToLongTimeString().Replace(":", ""), @"Domain\Acnt", "", "Automated Build Label");

            LabelItemSpec[] labelspecs = new LabelItemSpec[1];

            labelspecs[0] = new LabelItemSpec(new ItemSpec("$/First/Sample", RecursionType.Full), VersionSpec.Latest, false);

            LabelResult[] lr = vcs.CreateLabel(vcLabel, labelspecs, LabelChildOption.Replace); //Exception thrown here.

        }

 

This simple function would result in an exception “TF14098: Access Denied: User needs Label permission(s) for .” as follows,

image

The same code, when run across TFS 2010, 2012 or 2013 would pass.

We’ve identified this as an issue with TFS 2015 RTM and Update 1, where TFS doesn’t like “” for scope. You can work-around this by either replacing it with null or '$/' instead of the empty string, ie,

VersionControlLabel vcLabel = new VersionControlLabel(vcs, "LabTest_" + DateTime.Now.ToLongTimeString().Replace(":", ""), @"Domain\Acnt", null, "Automated Build Label"); This will be fixed in TFS 2015 Update 2.

Content created by – Manigandan Balachandran
Content reviewed by – Vimal Thiagaraj

Comments

  • Anonymous
    December 04, 2015
    Thanks for providing this workaround and letting us know when it will be fixed!  The workaround works fine.