Created
May 4, 2025 16:59
-
-
Save geiltonxavier/0b803ff7a0aa156c3997546581832a77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task UpdateDynamicsRecordAsync(string recordId, string updateData) | |
{ | |
using (var httpClient = new HttpClient()) | |
{ | |
// Assume GetAccessTokenAsync is a helper method to retrieve the access token | |
var token = await GetAccessTokenAsync("https://your-dynamics-url/"); | |
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); | |
var content = new StringContent(updateData, Encoding.UTF8, "application/json"); | |
var response = await httpClient.PatchAsync($"https://your-dynamics-url/api/data/v9.0/records({recordId})", content); | |
response.EnsureSuccessStatusCode(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment