PublishingWeb.GetVariationUrlFromSourceUrl method

Returns the current Variation URL for the current PublishingWeb object for a specific source PublishingWeb location.

Namespace:  Microsoft.SharePoint.Publishing
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

public string GetVariationUrlFromSourceUrl(
	string sourceUrl


Type: System.String

The source PublishingWeb URL.

Return value

Type: System.String
The corresponding URL of the sourceUrl in the current PublishingWeb.

This method is most commonly used for implementing the IWebPartVariationUpdate interface.

This code snippet demonstrates a Web Part that uses GetVariationUrlFromSourceUrl to translate its property WebAnchorLocation from an old value based on the PublishingWeb object named ownerWeb into its appropriate value in the current PublishingWeb.

string oldAnchor = this.WebAnchorLocation;
this.WebAnchorLocation = ownerWeb.GetVariationUrlFromSourceUrl(oldAnchor);