SPFolderHierarchy.GetSubFolder method

Gets the direct subfolder by name.

Namespace:  Microsoft.Office.Server.Utilities
Assembly:  Microsoft.Office.Server (in Microsoft.Office.Server.dll)

Syntax

'Declaration
Public Shared Function GetSubFolder ( _
    parentFolder As SPFolder, _
    strFolderName As String, _
    fEnsure As Boolean _
) As SPFolder
'Usage
Dim parentFolder As SPFolder
Dim strFolderName As String
Dim fEnsure As Boolean
Dim returnValue As SPFolder

returnValue = SPFolderHierarchy.GetSubFolder(parentFolder, _
    strFolderName, fEnsure)
public static SPFolder GetSubFolder(
    SPFolder parentFolder,
    string strFolderName,
    bool fEnsure
)

Parameters

  • fEnsure
    Type: System.Boolean

    Whether to ensure the folder’s creation.

Return value

Type: Microsoft.SharePoint.SPFolder
The retrieved folder.
Returns SPFolder.

Remarks

This method does not inflate the SPFolder.SubFolders collection since that property can be throttled in large lists. Therefore multiple calls for the subfolders of the same folder, will cause a query to be performed each time.

See also

Reference

SPFolderHierarchy class

SPFolderHierarchy members

Microsoft.Office.Server.Utilities namespace