以编程方式连接到TFS [英] Programatically Connecting to TFS
问题描述
您好,
我需要在Outlook电子邮件中创建TFS中的工作项。我们已经看过一个我们之前使用的加载项(WitIt),但它不支持最新版本的Outlook。
I need to Create Work Items in TFS from Outlook Email. We have seen a Add-in (WitIt) which we have used previously but it is not supporting to the latest version of Outlook.
所以我们决定创建一个新的Outlook加载项,让我们在TFS中创建包含所有必需数据的工作项。
So we decided to create a new Outlook Add-in which provide us to create Work Item in TFS with all the required data.
作为第一部分,我尝试以编程方式从C#连接TFS,但在解决了许多问题后我终于得到了在授权问题上结构。
As a part of that first I have tried to connect with the TFS programatically from C# but after solving many issues I finally got struct at authorization issue.
"您无权连接到TFS"
任何人都可以帮助我确切地说它是什么。
Can any one help me exactly what it is.
我可以访问TFS并且我能够检入TFS中的代码但是我已经提供了我的凭据并尝试以编程方式连接它显示错误。
I have access to TFS and I am able to check in the code in TFS but I have given my credentials and try to connect through programatically it is showing the error.
提前致谢,
Hari Krishna
Hari Krishna
推荐答案
您好Hari Hirshna,
Hi Hari Hirshna,
感谢您在此发帖。
您的TFS版本是什么?如果你想连接到TFS2015或TFS2017,我建议你可以尝试使用以下代码连接到TFS:
What is the version of your TFS? If you want to connect to TFS2015 or TFS2017, I suggest that you could try to use the following code to connect to TFS:
using Microsoft.TeamFoundation.Client;
using Microsoft.VisualStudio.Services.Common;
using System;
using System.Net;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
NetworkCredential netCred = new NetworkCredential(@"Domain\Account", @"Password");
Microsoft.VisualStudio.Services.Common.WindowsCredential winCred = new Microsoft.VisualStudio.Services.Common.WindowsCredential(netCred);
VssCredentials vssCred = new VssCredentials(winCred);
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("http://XXX:8080/tfs/DefaultCollection"),
vssCred);
tpc.Authenticate();
}
}
}
如果您还有任何问题,可以在这里发布您的代码,我会尝试修改你的代码。:)
If you still have any problem, you could post your code here, I will try to modify your code.:)
最好的问候
Limitxiao Gao
Limitxiao Gao
这篇关于以编程方式连接到TFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!