共用方式為


SPUtility.CreateParentFoldersForFile Method

Creates a folder hierarchy necessary to create a list item, including the list in which to create the item, as well as an indication whether to create additional list items that correspond to the folders.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Sub CreateParentFoldersForFile ( _
    list As SPList, _
    url As String, _
    createAsListItem As Boolean _
)
'Usage
Dim list As SPList
Dim url As String
Dim createAsListItem As BooleanSPUtility.CreateParentFoldersForFile(list, _
    url, createAsListItem)
public static void CreateParentFoldersForFile(
    SPList list,
    string url,
    bool createAsListItem
)

Parameters

  • url
    Type: System.String

    The URL of the list item to be created.

  • createAsListItem
    Type: System.Boolean

    true to create list items that correspond to the folders; otherwise, false.

Exceptions

Exception Condition
ArgumentException

list is a null reference (Nothing in Visual Basic).

Remarks

Set the createAsListItem parameter to true when creating list items that correspond to the folder structure, which may be useful when creating lists that are not document library lists.

See Also

Reference

SPUtility Class

SPUtility Members

Microsoft.SharePoint.Utilities Namespace