Skip to content

Instantly share code, notes, and snippets.

@Gerhard-ZA
Created February 13, 2022 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gerhard-ZA/8c661c9f9723da53a4a96522db934daa to your computer and use it in GitHub Desktop.
Save Gerhard-ZA/8c661c9f9723da53a4a96522db934daa to your computer and use it in GitHub Desktop.
Upload file to Acumatica
public string PutFile(string entityName, string keys, string fileName, Stream file)
{
var response = _httpClient.PutAsync(_httpClient.BaseAddress + entityName + "/" + keys + "/files/" + fileName, new StreamContent(file)).Result;
if (!response.IsSuccessStatusCode)
{
return response.Content.ReadAsStringAsync().Result;
}
else return response.Content.ReadAsStringAsync().Result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment