Я пишу программу, в которой я использую список webservice sharepoint и метод webclient.DownloadFile для C# для загрузки всех файлов в список. Список содержит 1800 файлов, которые отображаются на 18 страницах, что приводит к 100 файлам на каждой странице. Однако мой код загружает файлы только на первых 10 страницах (1000 файлов из 1800 файлов). Кто-нибудь знает, в чем проблема? Вот мой кодЗагрузка из списка Sharepoint с помощью webservice
XmlNode ndListItems = null;
XmlDocument xdoc = new XmlDocument();
XmlNode ndQuery = xdoc.CreateNode(XmlNodeType.Element, "Query", "");
XmlNode ndViewFields = xdoc.CreateNode(XmlNodeType.Element, "ViewFields", "");
XmlNode ndQueryOptions = xdoc.CreateNode (XmlNodeType.Element, "QueryOptions", "");
ndQuery.InnerXml = "";
ndViewFields.InnerXml = "";
ndQueryOptions.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>";
ndListItems = list.GetListItems(ListName, "", ndQuery, ndViewFields, "1000", ndQueryOptions, null);
if (ndListItems!=null)
{ foreach (XmlNode node in ndListItems.ChildNodes) { if (node.Name=="rs:data")
{ string[] foldernames = new string[node.ChildNodes.Count];
for (int i = 0; i < node.ChildNodes.Count; i++) { if (node.ChildNodes[i].Name == "z:row" && node.ChildNodes[i].Attributes != null)
{ string fileurl= node.ChildNodes[i].Attributes["ows_ServerUrl"].Value;
string filename = node.ChildNodes[i].Attributes["ows_LinkFilename"].Value;
string contenttype = node.ChildNodes[i].Attributes["ows_ContentType"].Value;
string copysource = serverAddress + fileurl;
Uri copyUrl = new Uri(copysource);
if (contenttype=="Folder")
{ foldernames[i] = filename;
Directory.CreateDirectory(copyDestination+ filename); continue; } try {
int index = FolderNamseContain(filename, copysource, foldernames);
if (index != -1) { wc.DownloadFile(copysource, copyDestination + foldernames[index] + "\\" + filename);
report.Write(fileurl);
report.WriteLine();
report.Flush(); }
О, какая ошибка, которую я совершил! Большое вам спасибо :) –
@ user1260960: лучший способ поблагодарить sga101 - щелкнуть стрелку вверх и принять галочку ответа на этот вопрос. –