2017-08-01 59 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"};