Share via


CreateNewFolder Method

The CreateNewFolder method of the Imaging service creates a new folder with the name "New folder" in the specified list and folder. If a folder called "New folder" already exists in the specified folder, the CreateNewFolder method tries to create "New folder(1)", "New folder(2)", and so on.

Parameters

strListName    The name of the list within the current site.

strParentFolder    The relative path from the root of the list to the parent folder.

Return Value

A Microsoft.SharePoint.SoapServer.SoapXml object that contains the following:

<NewFolder xmlns="http://schemas.microsoft.com/sharepoint/soap/ois/" title="newFolder"/>

Error Values

The following table shows errors that may be returned by the CreateNewFolder method.

Error Code Description
0x1 ListNotFound: The requested list is not found.
0x2 IsNotLibrary: The requested list, although found, is not a picture library.
0x3 ItemNotFound: The requested list item is not found.
0x4 FolderNotFound: The requested folder is not found.
0x5 InvalidArgument: One or more arguments are not valid.
0x6 FileExists: The file already exists, and the user doesn't specify the overwrite option.

Example

This example shows how to create a new folder called "My Pictures" in the folder "1" that is automatically created when you create a picture library.

Note  This code assumes that the site and the picture library already exist and that you have permissions on the server. If the site and picture library do not exist, see the example below.

This example shows how to create the site and the picture library required in the preceding example.

Note  You must be a member of the Administrator site group on the Microsoft Windows SharePoint Services server to be able to add a reference to the Admin Web service and to perform the required actions.

SOAP Request Format

The following is a sample SOAP request. The placeholders shown need to be replaced with actual values.

POST /_vti_bin/imaging.asmx HTTP/1.1
Host: Server_Name
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/ois/CreateNewFolder"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CreateNewFolder xmlns="http://schemas.microsoft.com/sharepoint/soap/ois/">
      <strListName>string</strListName>
      <strParentFolder>string</strParentFolder>
    </CreateNewFolder>
  </soap:Body>
</soap:Envelope>

SOAP Response Format

The following is a sample SOAP response. The placeholders shown will be replaced with actual return values.

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CreateNewFolderResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/ois/">
      <CreateNewFolderResult>
        <xsd:schema>schema</xsd:schema>xml</CreateNewFolderResult>
    </CreateNewFolderResponse>
  </soap:Body>
</soap:Envelope>

Requirements

Platforms: Microsoft Windows Server 2003

Web Reference: http://Server_Name/[sites/][Site_Name/]_vti_bin/Imaging.asmx