Web.GetFolderByServerRelativeUrl Method

Returns the folder 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 (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<RemoteAttribute> _
Public Function GetFolderByServerRelativeUrl ( _
    serverRelativeUrl As String _
) As Folder
'Usage
Dim instance As Web
Dim serverRelativeUrl As String
Dim returnValue As Folder

returnValue = instance.GetFolderByServerRelativeUrl(serverRelativeUrl)
[RemoteAttribute]
public Folder GetFolderByServerRelativeUrl(
    string serverRelativeUrl
)

Parameters

  • serverRelativeUrl
    Type: System.String

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

Return Value

Type: Microsoft.SharePoint.Client.Folder
A Folder object that represents the folder.

Exceptions

Exception Condition
FileNotFoundException

serverRelativeUrl does not correspond to a folder or a file or does not to start with a ‘/’. Error code: -2147024809.

Remarks

You must have Browse Directories permissions to run code that uses the GetFolderByServerRelativeUrl method.

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

See Also

Reference

Web Class

Web Members

Microsoft.SharePoint.Client Namespace