|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TFSFunctions.cs" company="">
//
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace HtmlFieldsInReports
{
#region
using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework.Server;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
#endregion
public static class TFSFunctions
{
#region Public Methods and Operators
public static WorkItemCollection ExecuteQuery(WorkItemStore store, string query, string teamProjectName, string processStepWorkItemType)
{
query = query.ToLower().Replace("@project", teamProjectName);
query = query.ToLower().Replace("@processstepworkitemtype", processStepWorkItemType);
return store.Query(query);
}
public static Uri GetTFSUri(TeamFoundationRequestContext requestContext)
{
return new Uri(requestContext.GetService<TeamFoundationLocationService>().GetServerAccessMapping(requestContext).AccessPoint.Replace("localhost", Environment.MachineName) + "/" + requestContext.ServiceHost.Name);
}
public static TfsTeamProjectCollection GetTeamProjectCollection(string requestContextVirtualDirectory, string workItemChangedEventDisplayUrl)
{
string tpcUrl = GetTeamProjectCollectionUrl(requestContextVirtualDirectory, workItemChangedEventDisplayUrl);
var collection = new TfsTeamProjectCollection(new Uri(tpcUrl));
collection.EnsureAuthenticated();
return collection;
}
public static string GetTeamProjectCollectionUrl(string requestContextVirtualDirectory, string workItemChangedEventDisplayUrl)
{
string[] strArray = workItemChangedEventDisplayUrl.Split('/');
return string.Format("{0}//{1}{2}", strArray[0], strArray[2], requestContextVirtualDirectory);
}
public static WorkItemStore GetWorkItemStore(TfsTeamProjectCollection collection)
{
return (WorkItemStore)collection.GetService(typeof(WorkItemStore));
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.