本文介绍了如何在两个日期之间从queryhistory中找到serveritem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 使用System; 使用System.Collections.Generic; 使用System.ComponentModel; 使用System.Data; 使用System.Drawing; 使用System.Linq; 使用System.Text; 使用System.Windows.Forms ; 使用Microsoft.TeamFoundation.Client; 使用Microsoft.TeamFoundation.VersionControl.Client; 使用System.Net; 使用System.Collections; 命名空间tfs { 公共部分课程表格1:表格 { public Form1() { InitializeComponent(); } TeamFoundationServer tfsh; VersionControlServer versionControl; // string Collection = string.Empty; private void Button1_Click(object sender,EventArgs e) { TeamFoundationServer tfsh; VersionControlServer versionControl; System.Net。 NetworkCredential credential = new System.Net.NetworkCredential(TextBox1.Text,TextBox2.Text); string TFSServerPath = @http:// wr03svr80610728:8080 / tfs / ICICIL; //字符串TFSServerPath = @https://app2.icicilombard.com/tfs/ilprojectcollection04; tfsh = new TeamFoundationServer(TFSServerPath,凭证); tfsh.Authenticate(); MessageBox.Show(已连接到TFS); versionControl =(VersionControlServer)tfsh.GetService(typeof(VersionControlServer)); string fromdate = textBox3.Text; string todate = textBox4 .Text; DateTime fd = Conve rt.ToDateTime(fromdate); DateTime td = Convert.ToDateTime(todate); VersionSpec fromDateVersion = new DateVersionSpec(fd); VersionSpec toDateVersion = new DateVersionSpec(td); // IEnumerable Data = versionControl.QueryHistory($ /,VersionSpec.Latest ,0,RecursionType.Full,null,fromDateVersion,toDateVersion,int.MaxValue,true,true); string user =; IEnumerable Data = versionControl.QueryHistory ($ / ICICIL / MIGRATION_UAT / PRODUCTS / LoanProducts.ICICI,VersionSpec.Latest,0,RecursionType.Full,user,fromDateVersion,toDateVersion,int.MaxValue,true,true); ItemSet项目= versionControl.GetItems($ / ICICIL / MIGRATION_UAT / PRODUCTS / LoanProducts.ICICI,VersionSpec.Latest,RecursionType.Full); IEnumerable item = items.Items; StringBuilder sb = new StringBuilder(); string Collection = string.Empty; string test = string.Empty; try { foreach(数据中的变更集) { 集合+ =变更集: + o.ChangesetId +-----+ o.CreationDate +\\ n; } richTextBox1.Text = Collection.ToString(); } catch(例外情况) { MessageBox.Show(ex.Message); } 试试 { foreach(数据中的第i项) { test + =Item:+ i.ServerItem +-----+\\\\ n; } richTextBox2.Text = test.ToString(); } catch(例外情况) { MessageBox.Show(ex.Message); } // richTextBox1。 Text = Collection.ToString(); // richTextBox1.Text = sb.ToString(); } private void dateTimePicker1_ValueChanged(object sender,EventArgs e) { DateTime d1 = dateTimePicker1.Value; this.textBox3.Text = d1 .Date.ToString(); } private void dateTimePick er2_ValueChanged(object sender,EventArgs e) { DateTime d2 = dateTimePicker2.Value; this.textBox4.Text = d2.Date。 ToString(); } } } 无法转换类型为'Microsoft.TeamFoundation.VersionControl的对象。 Client.Changeset'键入'Microsoft.TeamFoundation.VersionControl.Client.Item'。解决方案 这篇关于如何在两个日期之间从queryhistory中找到serveritem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-13 19:13