We use to have different plugins in TFS 2010 that use "ServerAccessMapping" from TeamFoundationLocationService and it seems to get removed from Microsoft.TeamFoundation.Framework.Server.dll 11.0.
So these codes are no longer built.
var tfsLocalService = requestContext.GetService<TeamFoundationLocationService>();var tfsUri = tfsLocalService.GetSelfReferenceUri(requestContext, tfsLocalService.ServerAccessMapping);
var tfsTeamProjectCollection = new TfsTeamProjectCollection(tfsUri);
var buildService = tfsTeamProjectCollection.GetService(typeof(IBuildServer)) as IBuildServer;
var teamProject = buildService.GetBuild(new Uri(@event.Build.Uri)).TeamProject;
Note: we prefer to use this codes in getting Team Collections/Project rather have to pass in the TFS URI.