sharepoint - 如何在给定站点 URL 的情况下找到 SharePoint Web 应用程序的 URL

标签 sharepoint sharepoint-2007 sharepoint-api

我需要找到给定站点的 Web 应用程序的 URL(假设我有一个 URL http://code/sites/java。给定此网站集的 URL,我需要托管此网站集的 Web 应用程序的 URL。在此如果是 http://code。) 任何输入将不胜感激。

最佳答案

  1. 如果您有一个 SPWeb 对象,请使用它的 Site属性(property)。如果您有一个 SPSite 对象,请使用它的 WebApplication属性(property)。如果您都没有,create an SPSite object从那个网址。

  2. 从 SPWebApplication 对象使用 AlternateUrls属性(property)。

  3. 来自 SPAlternateUrlCollection对象检索您所需区域的 SPAlternateUrl。

  4. 来自 SPAlternateUrl对象获取实际的 URL。

您需要通过备用 URL 集合的原因是因为您可以使用备用访问映射 associate with a web application .比如所有的web应用都以Default开头,可以扩展到Intranet、Extranet等。

记得根据需要对上述对象使用 dispose。

关于sharepoint - 如何在给定站点 URL 的情况下找到 SharePoint Web 应用程序的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1542586/

相关文章:

visual-studio-2010 - Visual Studio 中的 SharePoint 开发,无需在每次代码更改时进行部署/调试

在 SharePoint 中调试自定义计时器作业

SharePoint - 无需手动解析即可获取计算字段的值

Sharepoint 多重身份验证

c# - 如何引用一个API的两个版本?

sharepoint - 修改共享点编辑对话框

jquery - 后置函数错误 : An entry without a type name was found

visual-studio - 无法在 Sharepoint 中调试自定义计时器作业

c# - "Encoded"SharePoint 客户端对象模型中的登录名

c# - Sharepoint PeopleEditor : How to find out what kind of user/group is returned?