SPAlternateUrlCollectionManager class
提供可用來執行伺服器陣列中的所有SPAlternateUrlCollection物件上的作業的方法。
Inheritance hierarchy
System.Object
Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPAlternateUrlCollection>
Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPAlternateUrlCollection>
Microsoft.SharePoint.Administration.SPAlternateUrlCollectionManager
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
<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物件。
Examples
下列範例會驗證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.");
}
Thread safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.