Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown when downloading the file form sharepoint document library
-
Hi, I am using copy service(copy.asmx) to download the files from sharepoint document library. In sharepoint server, I have created a doument library and this library contain serveral folders , i have to downlaod the files from document library folder but when i call the GetItem() method of copy service then throw exception SoapServerException . I am using following code to download the file. // sharepoint is a web reference that points to http://sharepoint/\_vti\_bin/copy Copy myCopyService = new Copy(); myCopyService.Url = url + "/_vti_bin/copy.asmx"; myCopyService.PreAuthenticate = true; myCopyService.Credentials = new System.Net.NetworkCredential("Administrator", "Path1234", "e1srv245"); // URL to the file you want to downlaod string copySource = url + "/PaymentAttachment/105/"+ fileName; //HtmlAnchor anchor = new HtmlAnchor(); //anchor.Target = "_blank"; //anchor.HRef = copySource; // Define the variables that will store the output from the web service call FieldInformation myFieldInfo = new FieldInformation(); FieldInformation[] myFieldInfoArray = { myFieldInfo }; byte[] myByteArray; // Call the web service uint myGetUint = myCopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray); // Convert into Base64 String string base64String; base64String = Convert.ToBase64String(myByteArray, 0, myByteArray.Length); // Convert to binary array byte[] binaryData = Convert.FromBase64String(base64String); // Create a temporary file to write the text of the form to string tempFileName = Path.GetTempPath() + "\\" + myFieldInfoArray[0].Value; // Write the file to temp folder FileStream fs = new FileStream(tempFileName, FileMode.CreateNew, FileAccess.ReadWrite); fs.Write(binaryData, 0, binaryData.Length); fs.Close(); I am not identifying, what i am missing?
-
Hi, I am using copy service(copy.asmx) to download the files from sharepoint document library. In sharepoint server, I have created a doument library and this library contain serveral folders , i have to downlaod the files from document library folder but when i call the GetItem() method of copy service then throw exception SoapServerException . I am using following code to download the file. // sharepoint is a web reference that points to http://sharepoint/\_vti\_bin/copy Copy myCopyService = new Copy(); myCopyService.Url = url + "/_vti_bin/copy.asmx"; myCopyService.PreAuthenticate = true; myCopyService.Credentials = new System.Net.NetworkCredential("Administrator", "Path1234", "e1srv245"); // URL to the file you want to downlaod string copySource = url + "/PaymentAttachment/105/"+ fileName; //HtmlAnchor anchor = new HtmlAnchor(); //anchor.Target = "_blank"; //anchor.HRef = copySource; // Define the variables that will store the output from the web service call FieldInformation myFieldInfo = new FieldInformation(); FieldInformation[] myFieldInfoArray = { myFieldInfo }; byte[] myByteArray; // Call the web service uint myGetUint = myCopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray); // Convert into Base64 String string base64String; base64String = Convert.ToBase64String(myByteArray, 0, myByteArray.Length); // Convert to binary array byte[] binaryData = Convert.FromBase64String(base64String); // Create a temporary file to write the text of the form to string tempFileName = Path.GetTempPath() + "\\" + myFieldInfoArray[0].Value; // Write the file to temp folder FileStream fs = new FileStream(tempFileName, FileMode.CreateNew, FileAccess.ReadWrite); fs.Write(binaryData, 0, binaryData.Length); fs.Close(); I am not identifying, what i am missing?