Export (0) Print
Expand All

Web.GetFileByServerRelativeUrl method

Returns the file object located at the specified server-relative URL.

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client.Phone (in Microsoft.SharePoint.Client.Phone.dll)  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

public File GetFileByServerRelativeUrl(
	string serverRelativeUrl
)

Parameters

serverRelativeUrl
Type: System.String

A string that specifies the server-relative URL for the file.

Return value

Type: Microsoft.SharePoint.Client.File
A File object that represents the file.

ExceptionCondition
ArgumentException

The serverRelativeUrl does not start with a '/' or serverRelativeUrl does not correspond to a file.

It must not be a null reference (Nothing in Visual Basic). It must not be empty.

Show:
© 2015 Microsoft