Web.GetFileByServerRelativeUrl method
Returns the file object located at the specified server-relative URL.
Namespace: Microsoft.SharePoint.Client
Assembly: Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
Syntax
'Declaration
Public Function GetFileByServerRelativeUrl ( _
serverRelativeUrl As String _
) As File
'Usage
Dim instance As Web
Dim serverRelativeUrl As String
Dim returnValue As File
returnValue = instance.GetFileByServerRelativeUrl(serverRelativeUrl)
public File GetFileByServerRelativeUrl(
string serverRelativeUrl
)
Parameters
serverRelativeUrl
Type: System.StringA string that specifies the server-relative URL for the file.
Return value
Type: Microsoft.SharePoint.Client.File
A File object that represents the file.
Exceptions
Exception | Condition |
---|---|
ArgumentException | The serverRelativeUrl does not start with a '/' or serverRelativeUrl does not correspond to a file. |
Remarks
It must not be a null reference (Nothing in Visual Basic). It must not be empty.