SPFile.ReplaceLink Method

Replaces all instances in the file of a specified link with a new link.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Sub ReplaceLink ( _
    oldUrl As String, _
    newUrl As String _
)
'Usage
Dim instance As SPFile
Dim oldUrl As String
Dim newUrl As String

instance.ReplaceLink(oldUrl, newUrl)
public void ReplaceLink(
    string oldUrl,
    string newUrl
)

Parameters

  • oldUrl
    Type: System.String

    The old absolute URL to be replaced.

  • newUrl
    Type: System.String

    The new absolute URL that replaces the old URL.

Exceptions

Exception Condition
SPException

An error occurred when updating the links.

See Also

Reference

SPFile Class

SPFile Members

Microsoft.SharePoint Namespace