Skip to content

Instantly share code, notes, and snippets.

View geiltonxavier's full-sized avatar

Geilton Xavier geiltonxavier

View GitHub Profile
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);
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "<storage-connection-string>",
"ServiceBusConnection": "<service-bus-connection-string>"
}
}
[FunctionName("ProcessQueueMessage")]
public static async Task Run(
[ServiceBusTrigger("queue-name", Connection = "ServiceBusConnection")] string message,
ILogger log)
{
log.LogInformation($"Received message: {message}");
// Process message: call further activity functions, update records, etc.
}
var azureServiceTokenProvider = new AzureServiceTokenProvider();
string accessToken = await azureServiceTokenProvider.GetAccessTokenAsync("https://servicebus.azure.net/");
var client = new ServiceBusClient("<ServiceBusNamespace>", new DefaultAzureCredential());
var sender = client.CreateSender("<QueueName>");
await sender.SendMessageAsync(new ServiceBusMessage("Hello from Dynamics 365!"));
[FunctionName("OrchestrateWorkflow")]
public static async Task<List<string>> RunOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context)
{
var outputs = new List<string>();
// Call a task and wait for the result.
outputs.Add(await context.CallActivityAsync<string>("FetchData", "recordId"));
// Fan out parallel tasks
Upload();
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests
// https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
void Upload()
{
Console.WriteLine("init - upload file");
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "API Service");
@geiltonxavier
geiltonxavier / fiddler-proxy-capture-request.xml
Created June 7, 2022 08:22
Capture Soap request using fiddler
<system.net>
<defaultProxy>
<proxy bypassonlocal="False" usesystemdefault="True" proxyaddress="http://127.0.0.1:8888" />
</defaultProxy>
</system.net>
Step 1: Download the Windows 11 ISO file
Step 2: Insert your USB storage drive into your Mac
Step 3: Use the diskutil command to identify which disk your USB drive is mounted on
- diskutil list
Step 4: Format your USB Drive to work with Windows
- diskutil eraseDisk MS-DOS "WIN11" GPT /dev/disk2 (It may be disk3 or disk4)
Step 5: Use hdiutil to mount the Windows 10 folder and prepare it for transfer
- hdiutil mount ~/Downloads/Win11.iso
Step 6: Copy the Windows 11 ISO over to your USB Drive
require 'minitest/autorun'
require './nama.rb'
describe "Nama Multiplos" do
before do
@nn = Nama.new
end
it "retorna multiplos de 5" do
@nn.print(5).must_equal "Nama"