Compartilhar via


SPAlternateUrlCollection Class

The SPAlternateUrlCollection class represents a collection of SPAlternateUrl objects.

Microsoft.SharePoint.SPBaseCollection

   Microsoft.SharePoint.Administration.SPAlternateUrlCollection

Public Methods

The following table shows the public methods of the SPAlternateUrlCollection class and a brief description of each.

Name Description
Add Adds the specified URL to the collection of alternate request URLs for the virtual server.
Delete(Int32) Deletes the alternate request URL at the specified index in the collection.
Delete(String) Deletes the specified alternate request URL from the collection.

Public Properties

The following table shows the properties of the SPAlternateUrlCollection class, the data type of each property, and a brief description of each.

Name Data Type Description
Count Int32 Gets the number of URLs in the collection.
Item(Int32) Microsoft.SharePoint.Administration.SPAlternateUrl Gets the URL object at the specified index in the collection.
Item(String) Microsoft.SharePoint.Administration.SPAlternateUrl Gets the URL object with the specified URL from the collection.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.

Remarks

Use the AlternateUrls property of the SPVirtualServerConfig class to return an SPAlternateUrlCollection object that represents the collection of alternate request URLs for a virtual server.

To create an alternate request URL, use the

Visit SPAlternateUrl

constructor to instantiate a URL object, and the Add method represented in the previous table to add the object to the collection of URL objects for the specified zone. A request URL can be specified only once per virtual server.

Use an indexer to return a single URL from the collection. For example, assuming the collection is assigned to a variable named myUrls, use myUrls[index] in C# or myUrls(index) in Visual Basic .NET, where index is either the index number of the item in the collection or a string containing the incoming URL of the request.

This class becomes available through installation of Service Pack 2 for Windows SharePoint Services 2.0.

For more information about the context for using alternate request URLs, see Advanced Extranet Support.

Example

The following code example creates a URL for the Intranet zone, adds it to the collection of alternate request URLs for the zone, and sets the outgoing URL for the zone.

For changes to take effect in this example, reset Microsoft Internet Information Services by typing iisreset at the command line.

Requirements

Namespace: Microsoft.SharePoint.Administration

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security