SPAlternateUrlCollectionManager 类

提供一些方法,可用于在服务器场中执行所有的SPAlternateUrlCollection对象上的操作。

继承层次结构

System.Object
  Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPAlternateUrlCollection>
    Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPAlternateUrlCollection>
      Microsoft.SharePoint.Administration.SPAlternateUrlCollectionManager

命名空间:  Microsoft.SharePoint.Administration
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPAlternateUrlCollectionManager _
    Inherits SPPersistedChildCollection(Of SPAlternateUrlCollection) _
    Implements IEnumerable(Of SPAlternateUrlCollection), IEnumerable(Of SPAlternateUrl),  _
    IEnumerable
用法
Dim instance As SPAlternateUrlCollectionManager
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPAlternateUrlCollectionManager : SPPersistedChildCollection<SPAlternateUrlCollection>, 
    IEnumerable<SPAlternateUrlCollection>, IEnumerable<SPAlternateUrl>, IEnumerable

备注

使用SPFarm.AlternateUrlCollections属性返回的SPAlternateUrlCollectionManager对象服务器场。

示例

下面的示例验证RebaseUriWithAlternateUri方法将默认区域传出 URL 转换为指定的传入 URL。

Dim altUrlCollection As SPAlternateUrlCollection = SPContext.Current.Site.WebApplication.AlternateUrls

Dim altUrlCollectionMgr As SPAlternateUrlCollectionManager = SPFarm.Local.AlternateUrlCollections

Dim incomingUri As New Uri("http://MyIncomingUrl")

Dim responseUri As Uri = altUrlCollectionMgr.RebaseUriWithAlternateUri(incomingUri, SPUrlZone.Default)

If responseUri = altUrlCollection.GetResponseUrl(SPUrlZone.Default).Uri Then
    Response.Write("Incoming URI converted to default outgoing URL.")
End If
SPAlternateUrlCollection altUrlCollection = SPContext.Current.Site.WebApplication.AlternateUrls;

SPAlternateUrlCollectionManager altUrlCollectionMgr = SPFarm.Local.AlternateUrlCollections;

Uri incomingUri = new Uri("http://MyIncomingUrl");

Uri responseUri = altUrlCollectionMgr.RebaseUriWithAlternateUri(incomingUri, SPUrlZone.Default);

if (responseUri == altUrlCollection.GetResponseUrl(SPUrlZone.Default).Uri)
{
    Response.Write("Incoming URI converted to default outgoing URL.");
}

线程安全性

该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

引用

SPAlternateUrlCollectionManager 成员

Microsoft.SharePoint.Administration 命名空间