2011-06-16 33 views
0

我試圖使用SharePoint Web Services上傳包含元數據的文件。我採用的第一種方法是使用WebRequest/WebResponse對象,然後使用Lists.asmx - UpdateListItems方法更新元數據。這工作得很好,但它創建了兩個版本的文件。我採用的第二種方法是使用Copy.asmx Web服務,並使用CopyIntoItems方法將文件數據與元數據一起復制。這工作正常,並創建V1.0,但當我嘗試上傳與元數據中的一些更改相同的文件(使用Copy.asmx)它不會更新任何東西。有沒有人遇到同樣的問題或有其他想法來實現所需的功能。使用SharePoint Web Services與元數據進行文件上載

感謝, 基蘭

+0

你在用嗎? g SharePoint 2007或2010? – CBono 2011-06-16 22:37:04

+0

我們正在使用SharePoint 2010. – user802355 2011-06-16 23:15:35

回答

1

這可能是有點話題(對不起),但我想與SharePoint遠程工作時給你的忠告,以一個真正的省時快捷,http://www.bendsoft.com/net-sharepoint-connector/

它可以讓您使用SQL和存儲過程處理SharePoint列表和文檔庫。

上傳文件作爲字節數組

... 
string sql = "CALL UPLOAD('Shared Documents', 'Images/Logos/mylogo.png', @doc)"; 

byte[] data = System.IO.File.ReadAllBytes("C:\\mylogo.png"); 
SharePointCommand cmd = new SharePointCommand(sql, myOpenConnection); 
cmd.Parameters.Add("@doc", data); 

cmd.ExecuteNonQuery(); 
... 

上傳流輸入

using (fs == System.IO.File.OpenRead("c:\\150Mb.bin")) { 
    string sql = "CALL UPLOAD('Shared Documents', '150Mb.bin', @doc)"; 
    SharePointCommand cmd = new SharePointCommand(sql, myOpenConnection); 
    cmd.Parameters.Add("@doc", fs); 
    cmd.ExecuteNonQuery(); 
} 

有相當多的方法,以簡化遠程文件管理

UPLOAD(lisname, filename, data) 
DOWNLOAD(listname, filename) 
MOVE(listname1, filename1, listname2, filename2) 
COPY(listname1, filename1, listname2, filename2) 
RENAME(listname, filename1, filename2) 
DELETE(listname, filename) 
CREATEFOLDER(listname, foldername) 
CHECKOUT(list, file, offline, lastmodified) 
CHECKIN(list, file, comment, type) 
UNDOCHECKOUT(list, file) 

乾杯

+0

我並不是真的想把錢花在所描述的工具上,但我得說 - 我真的很喜歡用其他方法來解決問題。此工具完全側重所有的Web服務身份驗證的東西(假設使用SP Web服務)... – barrypicker 2014-07-31 23:13:44

相關問題