Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Error when connect to Dynamics 365 From Desktop App

Posted on by 4,084

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;
}
}

  • Suggested answer
    Manoj Mane Profile Picture
    Manoj Mane 1,012 on at
    RE: Error when connect to Dynamics 365 From Desktop App

    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans