Imaging.Rename, méthode (websvcImaging)

Renames the specified files (items) in a list on the current Web site.

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

Syntaxe

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

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

Paramètres

  • strListName
    The name of the list within the current Web site.
  • strFolder
    The relative path from the root of the list to the target folder.
  • request
    The files to rename and the new base name. For example, to rename "tree.jpg" to "forest.jpg", the request parameter might resemble the following.

    <Request>
      <files>
        <file filename="tree.jpg" newbasename="forest"/>
        .
        .
        .
      </files>
    </Request>
    

Valeur retournée

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

<results xmlns="https://schemas.microsoft.com/sharepoint/soap/ois/">
  <result name="oldFileName0" renamed="true" 
    newbasename="newBaseName0"/>
  <result name="oldFileName1ThatDoesNotExist" renamed="false"/>
  .
  .
  .
</results>

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

The following example renames the image file the in the "My Pictures" picture library at http://MyServer/sites/mynewsite/MyPictures/1/Red Figure2.gif.

RemarqueRemarque :

This code assumes that the site and the picture library already exist and that you have permissions on the server. xmlele is a static variable that contains the XML request for renaming items.

Dim imgws As New Web_Reference.Imaging()
imgws.Credentials = System.Net.CredentialCache.DefaultCredentials
imgws.Url = "http://MyServer/sites/mynewsite/_vti_bin/imaging.asmx"
Dim resdoc As New System.Xml.XmlDocument()
Dim resnode As System.Xml.XmlNode = 
    resdoc.CreateNode(System.Xml.XmlNodeType.Element, "Result", "")
resnode = imgws.Rename("My Pictures", "1", xmlele)
MessageBox.Show(resnode.ChildNodes(0).InnerText)
Web_Reference.Imaging imgws = new Web_Reference.Imaging();
imgws.Credentials = System.Net.CredentialCache.DefaultCredentials;
imgws.Url = "http://MyServer/sites/mynewsite/_vti_bin/imaging.asmx";
System.Xml.XmlDocument resdoc= new System.Xml.XmlDocument();
System.Xml.XmlNode resnode = 
   resdoc.CreateNode(System.Xml.XmlNodeType.Element,"Result","");
resnode = imgws.Rename("My Pictures","1",xmlele);
MessageBox.Show(resnode.ChildNodes[0].InnerText);

Voir aussi

Référence

Imaging, classe
Membres Imaging
websvcImaging, espace de noms