sharepoint - 以编程方式获取团队项目的 SharePoint URL

标签 sharepoint tfs

我想通过编码找出给定的团队项目是否具有关联的 SharePoint。如果是,我还想获取 SharePoint 的 URL,以便创建指向它的特定链接。

我指的不是 TFS 的 Web 访问,而是关联的 SharePoint。有没有办法在不知道与 TFS 服务器不同的 SharePoint 服务器的 URL 的情况下找到这一点?

最佳答案

using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;

private static string RetrieveProjectPortalBaseAddress(TfsTeamProjectCollection tfs, string teamProject)
{
   IRegistration registration = (IRegistration)tfs.GetService(typeof(IRegistration));
   RegistrationEntry[] entries = registration.GetRegistrationEntries("TeamProjects");
   ServiceInterface endpoint = entries[0].ServiceInterfaces.FirstOrDefault(si => si.Name == teamProject + ":Portal");
   return endpoint.Url;
}

关于sharepoint - 以编程方式获取团队项目的 SharePoint URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13250871/

相关文章:

version-control - TFS - 执行文件合并时看不到目标分支

azure - Visual Studio Team Services - 限制通过 IP 地址进行访问?

tfs - 为什么TFS中存在文件名冲突

javascript - 使用 SP.PeoplePicker 中的 SP.Field 值更新 SP.ListItem

list - 如何按 Sharepoint 中的用户/组列过滤列表项?

TFS 2017 在线代码编辑器 : print . md (markdown)

git - VS 中的 TFS/GIT 无法切换到 master,因为有未提交的更改

css - Sharepoint webpart 刷新时如何重新应用 CSS

sharepoint - Active Directory 和 SSO - 有这方面经验的人吗?

c# - 有没有办法检查 Central Admin 以获取已安装/激活的 iFilters 列表?