Dws.CreateFolder Method

Creates a subfolder in the document library of the current Document Workspace site.

Namespace:  [DWS Web service]
Web service reference: http://Site/_vti_bin/DWS.asmx


<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/dws/CreateFolder", RequestNamespace := "http://schemas.microsoft.com/sharepoint/soap/dws/",  _
    ResponseNamespace := "http://schemas.microsoft.com/sharepoint/soap/dws/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function CreateFolder ( _
    url As String _
) As String
Dim instance As Dws
Dim url As String
Dim returnValue As String

returnValue = instance.CreateFolder(url)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/dws/CreateFolder", RequestNamespace = "http://schemas.microsoft.com/sharepoint/soap/dws/", 
    ResponseNamespace = "http://schemas.microsoft.com/sharepoint/soap/dws/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string CreateFolder(
    string url


  • url
    Type: System.String

    String. The proposed site-based URL of the folder to create; for example, "Shared Documents/folder_name".

Return Value

Type: System.String
A string that returns an empty <Result/> tag when successful.


Exception Condition

The user does not have sufficient rights.


The parent folder does not exist.


The CreateFolder method creates a new subfolder in a document library of the current Document Workspace site.


The following code example shows the use of the CreateFolder method to create a new subfolder in the default document library of the site. The absolute URL of the new folder is http://server_name/sites/user_name/workspace_name/Shared Documents/folder_name. For more information about the full text of the helper functions used in this example, see the CanCreateDwsUrl method.

    Dim strResult As String
    strResult = 
        dwsWebService.CreateFolder("Shared Documents/folder_name")
    If IsDwsErrorResult(strResult) Then
        Dim intErrorID As Integer
        Dim strErrorMsg As String
        Call ParseDwsErrorResult(strResult, intErrorID, strErrorMsg)
        MessageBox.Show _
            ("A document workspace error occurred." & vbCrLf & _
            "Error number: " & intErrorID.ToString & vbCrLf & _
            "Error description:" & strErrorMsg, _
            "DWS Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        MessageBox.Show("The folder was successfully created.", _
            "Create Folder", MessageBoxButtons.OK, _
    End If
Catch exc As Exception
    MessageBox.Show("An exception occurred." & vbCrLf & _
        "Description: " & exc.Message, _
        "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
    string strResult = "";
    strResult = 
        dwsWebService.CreateFolder("Shared Documents/folder_name");
    if (IsDwsErrorResult(strResult))
        int intErrorID  = 0;
        string strErrorMsg = "";
        ParseDwsErrorResult(strResult, out intErrorID, out strErrorMsg);
            ("A document workspace error occurred.\r\n" +
            "Error number: " + intErrorID.ToString() + "\r\n" +
            "Error description: " + strErrorMsg,
            "DWS Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            ("The folder was successfully created.",
            "Create Folder", MessageBoxButtons.OK,
catch (Exception exc)
    MessageBox.Show("An exception occurred.\r\n" +
        "Description: " + exc.Message,
        "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);

See Also


Dws Class

Dws Members

DWS Web Service