I am referring below link
and used following lines -
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"]);
}
to download an attachment.
But the following line
Stream responseStream = request.GetResponse().GetResponseStream();
in "MakeRequest" method gives "The remote server returned an error: (404) Not Found." error.
I found a solution for my question.
Solution:-
The below line of code-
SmartsheetRequest getAttachment = new SmartsheetRequest { callURL = "/attachment/" + attach.Id, method = "GET", contentType = "application/json" };
was changed to below line-
SmartsheetRequest getAttachment = new SmartsheetRequest { callURL = "/sheets/" + SheetID + "/attachments/" + attach.Id, method = "GET", contentType = "application/json"};