2017-08-01 61 views
0

下載一排附件我指以下鏈接使用智能表API C#

link

,並使用以下行 -

 public void downloadAttachment(Attachment attach) 
    { 
     SmartsheetRequest getAttachment = new SmartsheetRequest { callURL = "/attachment/" + attach.Id, method = "GET", contentType = "application/json" }; 
     var jsonGetAttachment = getAttachment.MakeRequest("null"); 
     getAttachment.DownloadAttachment(jsonGetAttachment["url"], jsonGetAttachment["sizeInKb"], jsonGetAttachment["name"]); 
    } 

下載附件。

但以下行

 Stream responseStream = request.GetResponse().GetResponseStream(); 
在 「makeRequest的」 方法

給出 「遠程服務器返回一個錯誤:(404)未找到」。錯誤。

回答

0

我找到了我的問題的解決方案。

解決方案: -

的代碼 -

SmartsheetRequest getAttachment = new SmartsheetRequest { callURL = "/attachment/" + attach.Id, method = "GET", contentType = "application/json" }; 

的下面線變更爲下述啉

SmartsheetRequest getAttachment = new SmartsheetRequest { callURL = "/sheets/" + SheetID + "/attachments/" + attach.Id, method = "GET", contentType = "application/json"};