Wie man sharepoint-Ordner nach Namen mit CamlQuery

Also muss ich umbenennen einer sharepoint-Ordner im plugin crm. Der name des Ordner ist ein fullname-von einem Kontakt, aber bei einem Tippfehler im Namen, es muss ein plugin zum ändern der Ordnernamen im sharepoint-aswell. Ich fand einen Weg, dies zu tun, aber dies zu tun, die ich brauche, um den Ordner und ich versuche, dies zu tun mit CamlQuery. (es ist eine sharepoint 2010)

Hier ist, was ich tun, um die Ordner:

            ClientContext clientContext = new ClientContext(siteUrl);
            clientContext.Credentials = new NetworkCredential(login, password);
            Web web = clientContext.Web;
            List list = web.Lists.GetByTitle(listName);

            string FolderFullPath = siteUrl + "contact/" + folderName;

            CamlQuery query = new CamlQuery();
            query.ViewXml = "<View Scope=\"RecursiveAll\"> " +
                            "<Query>" +
                                "<Where>" +
                                    "<And>" +
                                        "<Eq>" +
                                            "<FieldRef Name=\"FSObjType\" />" +
                                            "<Value Type=\"Integer\">1</Value>" +
                                         "</Eq>" +
                                          "<Eq>" +
                                            "<FieldRef Name=\"Title\"/>" +
                                            "<Value Type=\"Text\">" + folderName + "</Value>" +
                                          "</Eq>" +
                                    "</And>" +
                                 "</Where>" +
                            "</Query>" +
                            "</View>";

            if (relativePath.Equals(string.Empty))
            {
                query.FolderServerRelativeUrl = "/lists/" + listName;
            }
            else
            {
                query.FolderServerRelativeUrl = "/lists/" + listName + "/" + relativePath;
            }
            var folders = list.GetItems(query);

            clientContext.Load(list);
            clientContext.Load(list.Fields);
            clientContext.Load(folders, fs => fs.Include(fi => fi["Title"],
                fi => fi["DisplayName"],
                fi => fi["FileLeafRef"]));
            clientContext.ExecuteQuery();

Aber ich erhalte die Fehlermeldung: "Wert fällt nicht innerhalb des erwarteten Bereichs".

Hier ist der log:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Value does not fall within the expected range.Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ErrorCode>-2147220891</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
    <KeyValuePairOfstringanyType>
      <d2p1:key>OperationStatus</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">0</d2p1:value>
    </KeyValuePairOfstringanyType>
  </ErrorDetails>
  <Message>Value does not fall within the expected range.</Message>
  <Timestamp>2015-05-26T07:16:43.90779Z</Timestamp>
  <InnerFault i:nil="true" />

</OrganizationServiceFault>
InformationsquelleAutor el shorty | 2015-05-26
Schreibe einen Kommentar