Attaching an attachment to a request
Can I please have some help to attach a file to a request. I am using C#.
It may also be useful for the community to have some code in C# to do this action as well.
Here is my code:
- private static void HTTPPostAttachments()
{
var client = new HttpClient();
const string weblinkUrl = "http://wlgsduat01/sdpapi/request/670/attachment?OPERATION_NAME=ADD_ATTACHMENT&TECHNICIAN_KEY=58542C82-314A-4A2B-BCC1-998AC37109D1";
var method = new MultipartFormDataContent();
const string fileName = "H:\\ServiceDeskDataMigration\\Exported files\\Book1.csv";
var streamContent = new StreamContent(File.Open(fileName, FileMode.Open));
method.Add(streamContent ,"filename");
- var result = client.PostAsync(weblinkUrl, method);
MessageBox.Show(result.Result.ToString());
}
New to ADSelfService Plus?