Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Dynamics 365 On-Premise, Active Directory Account, IOrganisationService

Posted on by 5

My client is using On-Premise D365.
I need to connect with it using the SDK. Unfortunately the service returned is always null.

This is the code I have tried out.

private IOrganizationService GetService()
{
IOrganizationService service = null;
string value = System.Configuration.ConfigurationSettings.AppSettings["CRMConnectionString"];
CrmServiceClient conn = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(value);
return (IOrganizationService)((conn.OrganizationWebProxyClient != null) ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy);

}

The Connection string is like the following

<connectionStrings> 
<add name="CRMConnectionString" connectionString="AuthType=AD;Url=">contoso:8080/Test;" />

</connectionStrings>

Can you see some obvious flaws or mistakes?
Or
Could you give me an example of a working code?
Or
Could you let me know how best to fix it?

  • Johnny Gong Profile Picture
    Johnny Gong 6,482 on at
    RE: Dynamics 365 On-Premise, Active Directory Account, IOrganisationService

    Hi LastKnight,

    Would you mind sharing me your On-Premise D365 Version? If it's V9 OP , I test the return value won't be null after adding following TLS12 securityprotocol:

    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

    If you are using CRM 2016 and still couldn't get OrganizationWebProxyClient , I would suggest you to catch connect's ConnectedOrgFriendlyName field to check if you have any mistake in the app configue.

    System.Console.WriteLine("Connected Org Name:{0}", conn.ConnectedOrgFriendlyName);

    System.Console.ReadLine();

    Looking forward to hearing from you. Thanks.

    Regards

    Johnny

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans