Hi Members,
Can someone advise what I am missing in my code here in C#. But unable to connect to CRM. I am currently trying to configure this connectivity in my local environment.
string userName = "domain1\\user1";
string password = "test123";
string orgName = "hypernation.crm365.com/.../Organization.svc";
string internalurl = "hypernation.crm365.com";
NetworkCredential creds = new NetworkCredential(userName, CrmServiceClient.MakeSecureString(password));
Microsoft.Xrm.Tooling.Connector.AuthenticationType authType = Microsoft.Xrm.Tooling.Connector.AuthenticationType.AD;
CrmServiceClient conn = new CrmServiceClient(creds, authType, internalurl, "443", orgName, true, true, null);
I tried using connection string but no luck at all.
<add name="crm"
connectionString="AuthType=AD;Url=hypernation.crm365.com/.../Organization.svc; Domain=domain1; Username=domain1\user1; Password=test123;"/>
Here above is there any other alternative to configure connection string?
My main motive is to use the flag "RequireNewInstance=true". but can't seem to use it without CrmServiceClient instance.
I am able to connect to CRM using OrganizationServiceProxy class and can access entities fluently.
Thank you.
*This post is locked for comments
Not everyone can be wrong.
I re-read the whole articles and list of parameters and found that my "Url" parameter was the issue.
docs.microsoft.com/.../mt608573(v=crm.8)
My correct connection string becomes like below:
<connectionStrings>
<!-- On-premises using Windows integrated security -->
<add name="CRMConnectionString"
connectionString="Url=hypernation.crm365.com/hypernation; Username=domain1\user1;Password=test123;Domain=domain1;AuthType=AD;RequireNewInstance=true;"/>
</connectionStrings>
</configuration>
Thanks Ravi for your response.
I visited both the links and especially Carl's. What he advised I did that way but no luck. Honestly no matter whatsoever thing mentioned in this link i try I am not able to connect using CrmServiceClient. it always shows "IsReady" = false.
To answer your question. No, it is not IFD environment. It is on-premise.
Error message I am receiving is Unable to connect Dynamics CRM.
As I am able to connect using OrganizationServiceProxy, I know I can pass that proxy instance to initialize CrmServiceClient instance but how do I use RequireNewInstance=true property ? (this is my prime requirement)
Somehow I don't know to tweak the code to use it.
Please advise.
Hi,
You can find all combination with respect to the specifis type of environment in the below link-
docs.microsoft.com/.../mt608573(v=crm.8)
You can refer this blog as well: carldesouza.com/connecting-to-dynamics-365-using-crmserviceclient
Is it an IFD environment? What is the error you are getting when using CRMServiceClient? If you are able to connect using OrganizationServiceProxy , any specific reason you want to use CRMServiceClient?
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,902 Super User 2024 Season 2
Martin Dráb 229,316 Most Valuable Professional
nmaenpaa 101,156