public VisualStudioWorkItemHelper(string query) { var project = string.Empty; Uri uri = null; this.wiqlInstance = VisualStudioUtils.CreateWiql(query, out uri, out project); this.TeamUri = uri ?? DefaultTeamUri; this.ProjectName = project; this.VssWorkItemTrackingHttpClient = VisualStudioHttpClientPool.GetVssHttpClient <WorkItemTrackingHttpClient>(this.TeamUri); }
public VisualStudioWorkItemHelper(FileInfo wiqfile) { string currnetExecutableDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); this.wiqFile = wiqfile; if (!this.wiqFile.Exists) { throw new FileNotFoundException("Failed to load Query file.", this.wiqFile.FullName); } var project = string.Empty; Uri uri = null; this.wiqlInstance = VisualStudioUtils.CreateWiql(this.wiqFile, out uri, out project); this.TeamUri = uri ?? DefaultTeamUri; this.ProjectName = project; this.VssWorkItemTrackingHttpClient = VisualStudioHttpClientPool.GetVssHttpClient <WorkItemTrackingHttpClient>(this.TeamUri); }
public IEnumerable <WorkItem> QueryWorkItems(out string[] columnSequence, IEnumerable <string> fileds = null, string vsoFiledNamePrefixOverride = "System") { //// If the given fields is null, honor the fields specified in the wiql string //// If the given fileds is not null, pick the given fileds that specified in the wiql string var workItems = QueryWorkItemSummary(out columnSequence, fileds, WorkItemExpand.None); if (workItems != null) { foreach (var item in workItems) { var itemViewingUrl = string.Format(CultureInfo.InvariantCulture, "{0}/{1}/_workitems?id={2}", this.TeamUri, this.ProjectName, item.Id); item.Fields.Add(VisualStudioUtils.GetCustomVsoFiledRefName("Url", vsoFiledNamePrefixOverride), itemViewingUrl); var itemId = item.Id.HasValue ? item.Id.ToString() : string.Empty; item.Fields.Add(VisualStudioUtils.GetCustomVsoFiledRefName("Id", vsoFiledNamePrefixOverride), itemId); var assignedTo = VisualStudioUtils.GetAliasFromVsoWorkItemField(VisualStudioUtils.GetWorkItemFieldValue(item, "System.AssignedTo")); item.Fields.Add(VisualStudioUtils.GetCustomVsoFiledRefName("AssignedTo", vsoFiledNamePrefixOverride), assignedTo); } } return(workItems); }