Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Progress on Problem 2
=================
When we try to delete the private attachments via HTTP Delete (passing file_api_url with Auth token), it is throwing 401 (Unauthorized error) from inside/outside cognizant network. Also this is not getting executed via browser as well, as discussed, it would be really helpful if you can send some examples or code snippets for this case.

private static void DeleteAttachments(string DeleteURL)
{
HttpClient Client = new HttpClient();
HttpResponseMessage myWebResponse;

try
{
myWebResponse = Client.DeleteAsync(DeleteURL + "?access_token=xxxxxxxxxxxxxxx").Result;

if (myWebResponse.IsSuccessStatusCode)
{
Console.Out.WriteLine("Success");
}
else
Console.Out.WriteLine("Failed");
}
catch (Exception e)
{
Console.Out.WriteLine(e.Message);
}
finally
{
Client.Dispose();
myWebResponse = null;
}

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900