Dws.CreateFolder - Méthode

Crée un sous-dossier dans la bibliothèque de documents du site espace de travail de Document en cours.

Espace de noms :  WebSvcDWS
Assembly :  STSSOAP (dans STSSOAP.dll)

Syntaxe

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

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

Paramètres

  • url
    Type : System.String

    String. L'URL proposée sur site du dossier à créer ; par exemple, « Shared Documents /folder_name".

Valeur renvoyée

Type : System.String
Chaîne qui retourne vide < résultat / > lors de la réussite de la balise.

Exceptions

Exception Condition
[DWSError.NoAccess(3)]

L'utilisateur ne dispose pas de droits suffisants.

[DWSError.FolderNotFound(10)]

Le dossier parent n'existe pas.

Remarques

La méthode CreateFolder crée un nouveau sous-dossier dans une bibliothèque de documents du site espace de travail de Document en cours.

Exemples

L'exemple de code suivant illustre l'utilisation de la méthode CreateFolder pour créer un nouveau sous-dossier dans la bibliothèque de documents par défaut du site. L'URL absolue du nouveau dossier est https://server_name/sites/user_name/workspace_name/Shared Documents/folder_name. Pour plus d'informations sur le texte intégral des fonctions d'assistance utilisées dans cet exemple, consultez la méthode CanCreateDwsUrl .

Try
    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)
    Else
        MessageBox.Show("The folder was successfully created.", _
            "Create Folder", MessageBoxButtons.OK, _
            MessageBoxIcon.Information)
    End If
Catch exc As Exception
    MessageBox.Show("An exception occurred." & vbCrLf & _
        "Description: " & exc.Message, _
        "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
try
{
    string strResult = "";
    strResult = 
        dwsWebService.CreateFolder("Shared Documents/folder_name");
    if (IsDwsErrorResult(strResult))
    {
        int intErrorID  = 0;
        string strErrorMsg = "";
        ParseDwsErrorResult(strResult, out intErrorID, out strErrorMsg);
        MessageBox.Show
            ("A document workspace error occurred.\r\n" +
            "Error number: " + intErrorID.ToString() + "\r\n" +
            "Error description: " + strErrorMsg,
            "DWS Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else
    {
        MessageBox.Show
            ("The folder was successfully created.",
            "Create Folder", MessageBoxButtons.OK,
            MessageBoxIcon.Information);
    }
}
catch (Exception exc)
{
    MessageBox.Show("An exception occurred.\r\n" +
        "Description: " + exc.Message,
        "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

Voir aussi

Référence

Dws classe

Dws - Membres

WebSvcDWS - Espace de noms