使用智能 sheet API C# 下载行附件
Download a row attachment using smart sheet 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" 方法中给出 "The remote server returned an error: (404) Not Found." 错误。
我找到了我的问题的解决方案。
解决方法:-
下面一行代码-
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"};
下面我指的是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" 方法中给出 "The remote server returned an error: (404) Not Found." 错误。
我找到了我的问题的解决方案。
解决方法:-
下面一行代码-
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"};