SPFile.ServerRelativeUrl property

Gets the relative URL of the file based on the URL for the server.

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

Syntax

'Declaration
Public ReadOnly Property ServerRelativeUrl As String
    Get
'Usage
Dim instance As SPFile
Dim value As String

value = instance.ServerRelativeUrl
public string ServerRelativeUrl { get; }

Property value

Type: System.String
A string that contains the URL.

Remarks

The ServerRelativeUrl property returns a string in the following form, which excludes the name of the server or root folder: /Site_Name/Subsite_Name/Folder_Name/File_Name.

For information about the forms of URLs that are used in Microsoft SharePoint Foundation, see Guidelines for Using the Object Model.

See also

Reference

SPFile class

SPFile members

Microsoft.SharePoint namespace