Imaging.CreateNewFolder, méthode (websvcImaging)

Creates a new folder with the name "New folder" in the specified list and folder. If a folder named "New folder" already exists in the specified folder, the CreateNewFolder method tries to create "New folder(1)", "New folder(2)", and so on.

Espace de noms : websvcImaging
Assembly : STSSOAP (dans stssoap.dll)

Syntaxe

'Déclaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/ois/CreateNewFolder", RequestNamespace:="https://schemas.microsoft.com/sharepoint/soap/ois/", ResponseNamespace:="https://schemas.microsoft.com/sharepoint/soap/ois/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function CreateNewFolder ( _
    strListName As String, _
    strParentFolder As String _
) As XmlNode
'Utilisation
Dim instance As Imaging
Dim strListName As String
Dim strParentFolder As String
Dim returnValue As XmlNode

returnValue = instance.CreateNewFolder(strListName, strParentFolder)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/ois/CreateNewFolder", RequestNamespace="https://schemas.microsoft.com/sharepoint/soap/ois/", ResponseNamespace="https://schemas.microsoft.com/sharepoint/soap/ois/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public XmlNode CreateNewFolder (
    string strListName,
    string strParentFolder
)

Paramètres

  • strListName
    The name of the list within the current site.
  • strParentFolder
    The relative path from the root of the list to the parent folder.

Valeur retournée

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

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

Exceptions

Type d'exception Condition

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 does not specify the overwrite option.

Exemple

This example, CreateNewFolder("My Pictures", "1"), shows how to create a new folder named "New Folder" in the "My Pictures" picture library under the "1" folder. In this example, the new URL is " siteUrl/My Pictures/1/New Folder ".

RemarqueRemarque :

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 second example.

Dim imgws As New Web_Reference.Imaging()
imgws.Credentials = System.Net.CredentialCache.DefaultCredentials
imgws.Url = "http://MyServer/sites/mynewsite/_vti_bin/imaging.asmx"
imgws.CreateNewFolder("My Pictures", "1")
Web_Reference.Imaging imgws = new Web_Reference.Imaging();
imgws.Credentials = System.Net.CredentialCache.DefaultCredentials;
imgws.Url = "http://MyServer/sites/mynewsite/_vti_bin/imaging.asmx";
imgws.CreateNewFolder("My Pictures","1");

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

RemarqueRemarque :

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

Dim adminws As New Web_Reference.Admin()
adminws.Credentials = System.Net.CredentialCache.DefaultCredentials
Try
    adminws.CreateSite("http://MyServer/sites/my2003site", _
        "My 2003 New Site", "Manage content and pictures for year 
            2003", 1033, _
        "MPS#0", "User_Alias", "Display_Name", "someone@example.com", 
            "", "")
    Catch ex As Exception
        MessageBox.Show(ex.Message)
End Try

Dim listsws As New Web_Reference.Lists()
listsws.Credentials = System.Net.CredentialCache.DefaultCredentials
listsws.Url = "http://MyServer/sites/mynewsite/_vti_bin/lists.asmx"
Try
    listsws.AddList("My Pictures", "My personal pictures", 109)
    Catch ex1 As Exception
        MessageBox.Show(ex1.Message)
End Try

Dim imgws As New Web_Reference.Imaging()
imgws.Credentials = System.Net.CredentialCache.DefaultCredentials
imgws.Url = "http://MyServer/sites/mynewsite/_vti_bin/imaging.asmx"
imgws.CreateNewFolder("My Pictures", "1")
Web_Reference.Admin adminws = new Web_Reference.Admin();
adminws.Credentials= System.Net.CredentialCache.DefaultCredentials;
try
{
   adminws.CreateSite("http://MyServer/sites/my2003site",
   "My 2003 New Site","Manage content and pictures for year 
      2003",1033,"MPS#0",
   "User_Alias","Display_Name","someone@example.com","","");
}
catch(Exception ex)
{
   MessageBox.Show(ex.Message);
}
Web_Reference.Lists listsws = new Web_Reference.Lists();
listsws.Credentials = System.Net.CredentialCache.DefaultCredentials;
listsws.Url = "http://MyServer/sites/mynewsite/_vti_bin/lists.asmx";
try
{
   listsws.AddList("My Pictures","My personal pictures",109);
}
catch(Exception ex1)
{
   MessageBox.Show(ex1.Message);
}
Web_Reference.Imaging imgws = new Web_Reference.Imaging();
imgws.Credentials = System.Net.CredentialCache.DefaultCredentials;
imgws.Url = "http://MyServer/sites/mynewsite/_vti_bin/imaging.asmx";
imgws.CreateNewFolder("My Pictures","1");

Voir aussi

Référence

Imaging, classe
Membres Imaging
websvcImaging, espace de noms