web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Integrate with Microsoft Dynamics CRM API using ASP.NET Core

(0) ShareShare
ReportReport
Posted on by 8
hellow all :
 
Iam biggner developer in company and they ask me to build app in asp.net to print purchase order from d365 finOps  so ,
 
1- register app in AAD.
my program by GPT chat help 
// in appsettings.json file {  /DynamicsCRM/: {    /BaseUrl/: https://your-crm-instance.api.crm.dynamics.com/api/data/v9.0//,    /ClientId/: /your-client-id/,    /ClientSecret/: /your-client-secret/,    /TenantId/: /your-tenant-id/  }}// in DynamicsCRMService.cs file using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;using Microsoft.Extensions.Configuration;using Newtonsoft.Json;public class DynamicsCRMService{    private readonly HttpClient _httpClient;    public DynamicsCRMService(IConfiguration configuration, HttpClient httpClient)    {        _httpClient = httpClient;        var dynamicsCRMConfig = configuration.GetSection(/DynamicsCRM/);        _httpClient.BaseAddress = new System.Uri(dynamicsCRMConfig[/BaseUrl/]);        _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(/application/json/));    }    public async Task<string> GetPurchaseOrders()    {        var response = await _httpClient.GetAsync(/purchaseorders/);        response.EnsureSuccessStatusCode();        return await response.Content.ReadAsStringAsync();    }}//in program file builder.Services.AddHttpClient<DynamicsCRMService>();builder.Services.AddScoped<DynamicsCRMService>();// DynamicsCRMService controller using Microsoft.AspNetCore.Mvc;using System.Threading.Tasks;[ApiController][Route(/[controller]/)]public class PurchaseOrderController : ControllerBase{    private readonly DynamicsCRMService _dynamicsCRMService;    public PurchaseOrderController(DynamicsCRMService dynamicsCRMService)    {        _dynamicsCRMService = dynamicsCRMService;    }    [HttpGet]    public async Task<IActionResult> GetPurchaseOrders()    {        var purchaseOrders = await _dynamicsCRMService.GetPurchaseOrders();        return Ok(purchaseOrders);    }}
there is no error but not any result in https://localhost:5001/purchaseorder
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at
    Hi Community user,
     
    Your question confuses me. You talk about a CRM API, Dynamics 365 FinOps and some coding generated by GPT.
    In case you would need to print a purchase order from Dynamics 365 Finance and Operations, you can use this application. What is the exact business issue you are asked to solve? Why a separate ASP.NET application and what is the relation with CRM?
  • Community member Profile Picture
    8 on at
    thanks mr.andre 
    I think it is not available to them in d365 because they use manual way by excel sheet (import data from d365 by OData and make some queries to print purchase order) this way take long time, So they ask me to build app to get data from d365 and print in specific format.
    Now my ask is the program, right? why don’t run with me?
  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at
    Hi,
     
    I don't know if the coding generated by Chat GPT is reliable. As you are using a CRM API, I can't help you. My experience is mainly with Finance and Operations (both technical is functional). I have some functional knowledge of CRM, but not on the technical programming side. Still I wonder how purchase order details from FinOps would be needed to be retrieved with a CRM API.
  • Community member Profile Picture
    8 on at
     
    is there function to print PO as invoice report . they need to print as invoice to contract department .
  • Komi Siabi Profile Picture
    13,109 Most Valuable Professional on at
    Hi,
     
    You want to be able to print an Invoice report from a PO. 
     
    Is this PO created in D365 FinOps or from CRM?
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans