/// <summary>
        /// 从一个work项中获取WorkItemLinkInfoDetails。
        /// </summary>
        public IEnumerable <WorkItemLinkInfoDetails> GetWorkItemLinkInfos(int workitemID)
        {
            // 构造WIQL。
            string queryStr = string.Format(queryFormat, workitemID);

            Query linkQuery = new Query(this.WorkItemStore, queryStr);

            // 获取所有的WorkItemLinkInfo对象。
            WorkItemLinkInfo[] linkinfos = linkQuery.RunLinkQuery();

            // 定义一个WorkItemLinkInfoDetails类型的泛型变量。从WorkItemLinkInfo对象中获取WorkItemLinkInfoDetails。
            List <WorkItemLinkInfoDetails> detailsList = new List <WorkItemLinkInfoDetails>();

            foreach (var linkinfo in linkinfos)
            {
                if (linkinfo.LinkTypeId != 0)
                {
                    WorkItemLinkInfoDetails details = GetDetailsFromWorkItemLinkInfo(linkinfo);
                    Console.WriteLine(details.ToString());
                }
            }
            return(detailsList);
        }
Exemple #2
0
        /// <summary>
        /// Get the WorkItemLinkInfoDetails of a work item.
        /// </summary>
        public IEnumerable <WorkItemLinkInfoDetails> GetWorkItemLinkInfos(int workitemID)
        {
            // Construct the WIQL.
            string queryStr = string.Format(queryFormat, workitemID);

            Query linkQuery = new Query(this.WorkItemStore, queryStr);

            // Get all WorkItemLinkInfo objects.
            WorkItemLinkInfo[] linkinfos = linkQuery.RunLinkQuery();

            // Get WorkItemLinkInfoDetails from the  WorkItemLinkInfo objects.
            List <WorkItemLinkInfoDetails> detailsList = new List <WorkItemLinkInfoDetails>();

            foreach (var linkinfo in linkinfos)
            {
                if (linkinfo.LinkTypeId != 0)
                {
                    WorkItemLinkInfoDetails details = GetDetailsFromWorkItemLinkInfo(linkinfo);
                    Console.WriteLine(details.ToString());
                }
            }
            return(detailsList);
        }