我正在嘗試使用SharePoint Copy Web服務的CopyIntoItems方法將文檔文件加載到SharePoint中的文檔庫中。如何使用SharePoint Copy Web服務的CopyIntoItems方法?
下面的代碼執行並返回0(成功)。此外,CopyResult []數組返回1值,並帶有「成功」結果。但是,我無法在庫中的任何位置找到該文檔。
我有兩個問題:
- 任何人都可以看到什麼錯我的代碼或暗示的變化?
- 任何人都可以建議我怎麼可以在服務器端進行調試。我沒有大量的SharePoint經驗。如果我可以通過日誌記錄或服務器端的其他方法跟蹤發生了什麼,它可能會幫助我弄清楚發生了什麼。
代碼示例:
string[] destinationUrls = { Uri.EscapeDataString("https://someaddress.com/Reports/Temp") };
SPCopyWebService.FieldInformation i1 = new SPCopyWebService.FieldInformation { DisplayName = "Name", InternalName = "Name", Type = SPListTransferSpike1.SPCopyWebService.FieldType.Text, Value = "Test1Name" };
SPCopyWebService.FieldInformation i2 = new SPCopyWebService.FieldInformation { DisplayName = "Title", InternalName = "Title", Type = SPListTransferSpike1.SPCopyWebService.FieldType.Text, Value = "Test1Title" };
SPCopyWebService.FieldInformation[] info = { i1, i2 };
SPCopyWebService.CopyResult[] result;
byte[] data = File.ReadAllBytes("C:\\SomePath\\Test1Data.txt");
uint ret = SPCopyNew.CopyIntoItems("", destinationUrls, info, data, out result);
編輯得到的東西的工作:
我得到了我的代碼加入 「http://null」 到SourceUrl領域工作。 Nat的答案可能會出於這個原因。這是我爲改變它而改變的一行。
// Change
uint ret = SPCopyNew.CopyIntoItems("http://null", destinationUrls, info, data, out result);
應該不是使用Uri.EscapeUriString而不是Uri.EscapeDataString? – 2010-02-28 13:08:31
Uri.EscapeUriString對我更好。 – 2013-12-19 17:25:39