TFS SDK - 获取网络凭据提示

发布于 2024-11-12 17:05:09 字数 259 浏览 6 评论 0原文

我正在尝试获取网络提示,以便用户可以提供凭据。 我看到这个,但它没有帮助。有人可以提供一个更完整的例子吗? 目标是从 Word 插件中获取此信息,以便我可以根据 Word 文档中提到的功能点在 TFS 中创建工作项。因此,有人在文档中写入功能点,关闭它,然后它会要求网络凭据,以便它可以在 TFS 中创建工作项。

I am trying to get the network prompt so that user can provide the credentials.
I saw this and It does not help. Could somebody provide a more complete example?
The goal is is to get this from a Word Add-in so that I can create work items in TFS from the function points mentioned in the word document. So, somebody writes the function points in a document, closes it and It would ask for the network credentials so that It can create work items in the TFS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里人 2024-11-19 17:05:09

您想在连接时使用 UICredentialsProvider。以下示例展示了如何连接到 TFS 2010 项目集合:

// Connect to a project collection by Uri
try
{
    var projectCollectionUri = new Uri("http://tfs2010:8080/tfs/MyCollection");
    var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(projectCollectionUri, new UICredentialsProvider())
    projectCollection.EnsureAuthenticated();
}
catch (TeamFoundationServerUnauthorizedException ex)
{
    // handle access denied
}
catch (TeamFoundationServiceUnavailableException ex)
{
    // handle service unavailable
}
catch (WebException ex)
{
    // handle other web exception
}

You want to use the UICredentialsProvider when connecting. Here's an example that shows how you would connect to a TFS 2010 Project Collection:

// Connect to a project collection by Uri
try
{
    var projectCollectionUri = new Uri("http://tfs2010:8080/tfs/MyCollection");
    var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(projectCollectionUri, new UICredentialsProvider())
    projectCollection.EnsureAuthenticated();
}
catch (TeamFoundationServerUnauthorizedException ex)
{
    // handle access denied
}
catch (TeamFoundationServiceUnavailableException ex)
{
    // handle service unavailable
}
catch (WebException ex)
{
    // handle other web exception
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文