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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Error when connect to Dynamics 365 From Desktop App

(0) ShareShare
ReportReport
Posted on by 4,130

Hi 

What can be possibly wrong with this code as I' trying to connect to D365 from VS Desktop C#

I'm getting this error:

CurrentAccessToken = 'svcClient.CurrentAccessToken' threw an exception of type 'System.NullReferenceException'

string connectstr =
"AuthType= 'ClientSecret';" +
"url='">OrgName.crm3.dynamics.com';" +
"ClientID='75fbd615-af9a-4d2c-b072-d78da6635189';" +
"ClientSecret='wpy8Q~Z2DimQgaYSMNC0w5kaOBcWFUsW_4Zd5aNX';";

using (CrmServiceClient svcClient = new CrmServiceClient(connectstr))
{
if (!svcClient.IsReady)
{
Console.WriteLine("unable to connect!");
return;
}
}

I have the same question (0)
  • Suggested answer
    Manoj Mane Profile Picture
    1,020 on at

    Hi Alaa Ramadan,

    please refer the  below link:- 

    stackoverflow.com/.../connection-to-microsoft-dynamics-365-working-in-console-app-but-not-in-web-app


    Thanks,

    Manoj Mane.
    Please mark this as VERIFIED if it helps. image

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans