2012-08-10 64 views
0

我有存儲在SharePoint libarary像
filePathAndName =文件「HTTP://spstore/sites/appsitename/documentlibraryname/abc.xls」獲取存儲在sharepint documentlibrary文件的完整路徑

我需要能夠使用 byte [] buffer = System.IO.File.ReadAllBytes(filePathAndName)打開abc.xls文件;

但我得到一個錯誤說明。 uri格式不受支持。我如何獲得文件的完整路徑?

回答

0

你必須先下載文件。例如,你可以使用一個WebClient發送一個HTTP請求到遠程服務器並獲取該文件的內容:

using (var client = new WebClient()) 
{ 
    byte[] file = client.DownloadData("http://spstore/sites/appsitename/documentlibraryname/abc.xls"); 
    // TODO: do something with the file data 
} 
+0

我的問題是不是在讀取文件,但得到的文件的絕對路徑...我得到uri格式不支持錯誤 – sansid 2012-08-10 13:44:44

+0

什麼完整路徑?該文件存儲在Web服務器上。 – 2012-08-10 13:49:21

相關問題