How to download attachment using an url "sys_attachment.do?sys_id"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2017 11:51 AM
Hi,
I want to download attachment using url "sys_attachment.do?sys_id" directly instead of usinf rest API.
I have developed the C# Rest Service and inside this service I am calling the service now url directly to download the attachment.
My C# code is as below,
var client = new WebClient();
string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(userName + ":" + password));
client.Headers[HttpRequestHeader.Authorization] = "Basic " + credentials;
client.DownloadFile(new Uri("https://myinstance.service-now.com/sys_attachment.do?sys_id=1234567890"), "E://new_CIP.txt");
It downloads the file as a html code and not the expected one. I want to download large file in one go, I don't want use REST API.
Could you please help me on the same?
Thanks,
Jitesh Zende
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 03:41 AM
Hi Jitesh,
Are you done with this requirement. If yes, then pls share the code.
Thanks,
Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 03:53 AM
HI Jitesh,
please share the code