CRMServiceClient does not try to connect to Dynamics CRM - dynamics-crm

Using the latest SDK for Dynamics CRM, I am attempting to create a new CRMServiceClient([ConnectionString]). I try to do anything with it including a WHOAMI request, and I get Unable to Login to Dynamics OrganizationServiceProxy is null. When I run fiddler, nothing is even attempting to communicate to the server to attempt a login. I am unsure what is wrong, as I would have thought newing up a CRMServiceClient would have tried to connect since OrganizationServiceProxy is a child object of CRMServiceClient. Anyone have any ideas how to approach solving this?
var temp = new CrmServiceClient(ConfigurationManager.ConnectionStrings["con‌​n"].ConnectionString‌​);
<add name="conn" connectionString="AuthType=AD; Url=Url/DEVCRM; Username=User; Password=pass;"/>

Please note that CrmServiceClient has a boolean property called IsReady, which is a good way to check if it's in a proper state.
And for reference, here are example connection strings for the various environment types:
CRM 2016 and Dynamics 365 online:
<add name="dev26" connectionString="Url=https://dev26.crm.dynamics.com; Username=user#dev26.onmicrosoft.com; Password=Pass; AuthType=Office365" />
On-premise with integrated security:
<add name="prod" connectionString="Url=http://myserver/AdventureWorksCycle;"/>
On-premise with credentials:
<add name="prod" connectionString="Url=http://myserver/AdventureWorksCycle; Domain=mydomain; Username=administrator; Password=password; AuthType=AD;"/>
On-premise IFD before CRM 2016:
<add name="prod" connectionString="Url=https://contoso.litware.com; Username=someone#litware.com; Password=password; AuthType=IFD;"/>
On-premise IFD for CRM 2016 and later (v8.0+)
<add name="prod" connectionString="ServiceUri=https://contoso.litware.com/contoso; Domain=contoso; Username=contoso\administrator; Password=password; AuthType=IFD; LoginPrompt=Never;" />

Based on your connectionstring I would suggest you to add domain to it. That should resolve your issue. Check following example:
Named account using on-premises authentication
<add name="MyCRMServer"connectionString="AuthType=AD;Url=http://contoso:8080/Test;Domain=CONTOSO; Username=jsmith; Password=passcode" />
You can find more information in following article - https://msdn.microsoft.com/en-us/library/mt608573.aspx

I have found that .net 4.6.2 doesn't play nicely with the CRM SDK, if you are running that version of .net upgrade or downgrade the framework installed on your computer.
Updating to .net 4.6.2 from .net 4.5.2 causing Object Reference Exception on ExecuteCore method within xrm sdk
If that isn't the cause, enable tracing to get more detailed error messages, see following article for details: https://msdn.microsoft.com/en-au/library/dn689064.aspx

Related

retrieve specific columns from crm dynamics built in entity using Talend Open Studio

I have a requirement to integrate CRM dynamics 365 with MySQL db. The available tool is Talend Open Studio. So I have a few queries
-I need to retrieve a few columns from accounts, leads,opportunities, but I could not find a way to restrict the columns returns. Is there any way we can do it using tMicrosoftCrmInput? I am getting all the columns now.
How to do an incremental/delta data sync using Talend Open studio? I need to get the newly created and updated items
I tried to use tRestClient as well. but basic authentication getting failed with 401 error. How the headers and auth setting should be done?
Also,under basic settings when we use Authentication Type as : Online;ApI Version as:v2016(odata); Registered application type as:Web app with delegated permissions, why we need to give username,password along applicationid and secret?
It could be quite tough to get data from CRM Dynamics with talend.
To connect to Microsoft CRM Dynamics, i used tRESTClient , i didn't manage to get all i wanted with tMicrosoftCRMinput component.
Firsty you have to authenticate. My advice : try first to do it with a software like Postman. If you succeed with postman, you will be able to do it with talend (and if you don't, then problem is not talend).
You have to use a tRESTClient to connect to the auth service (https://login.microsoftonline.com/xxxx/oauth2/token)
Here is an exampleof my tRESTClient config. You'll need clientid and secret, i think user/password is not mandatory if you have id and secret. "resource" is the url to your dynamics crm. When connection is OK, retrieve token with a json extraction.

CRM 2016:Using Web API for CRM IFD to connect CRM Web Service

I'm new to Web API and trying to build a CRM Web Service application with C# by using Web API. Here is the sample code I'm using: C# application which authenticates against Azure AD using ADAL and communicates with Dynamics CRM.
This code works perfectly for AD authentication on premise CRM environment. But my environment is IFD, which means I have to use OAuth. it says method calls to the web services must be authorized with the identity provider for that service endpoint. However all the example point to Microsoft Azure Active Directory. but for real case, do we have to register a CRM app with Azure Active Directory?
Then how can I define the 'Client ID', 'RedirectUrl', 'Authority' in my code, where is my endppoint? We're using ADFS authentication.
Can anyone share some sample codes for this?
Thanks.

CRM 4.0 ISV page under CRM 2011 not showing correct user

I have a simple ISV page (using 2007 service endpoints, 4.0 SDK) that only shows the Identity of a user who has opened it.
System.Security.Principal.WindowsIdentity.GetCurrent().Name
This page in CRM 4.0 shows a valid user DOMAIN\USERNAME
When this page is deployed to CRM 2011 it only shows NT AUTHORITY\NETWORK SERVICE
The CRM 2011 has a Claims Based authentication configured together with IFD. There is a STS server and Credentials. All connections seem work fine. The page is accessed via: https://servername.domain.com/organization/main.aspx and in an intranet environment.
It just looks that the page can not pickup the identity of a user who has opened it.
Have you experienced this before? Is there something not configured correctly?
Thank you for your help.
To be sure what user is logged on you can use WhoAmI message. In that way you are able retrieve full information about the user.
Also ASP.Net provide a way to retrieve currently logged in user HttpContext.User Property. But it could contains different values, depending on Authentication Type. In case of IFD with claims-based authentication, HttpContext.User will contains id of SystemUser entity.

Client Credentials of the User Logged in CRM 2011 on-premises

I am trying to call a Web application from an IFrame in CRM 2011 On-Premises. In the Web Application , how can I get the Client Credentials of the User Logged in CRM to pass to the IOrganizationService?
I haven't worked with web applications for CRM 2011, as Microsoft is doing everything they can to make this as infeasible an option as possible, but in a client application, the following works for the credentials object to pass to the DiscoveryService/OrganizationService:
ClientCredentials credentials = new ClientCredentials()
{
Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials
};
It was somewhat similar for CRM 4 web applications, so this might work, but I have no idea what influence the fact might have that web applications for Eleven are supposed to run in their own IIS "Application" instead of the CRMWeb/ISV folder as in previous versions.
I've done it before,
Actually, I give a username, password and domain (impersonation) for an existing CRM user.
but I had not tried this before
Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials

VSTO: SecurityException Request for OraclePermission failed

We wrote a MS Word Add-In using VSTO 2.0. In this Add-in we've connected to a sql server database. Anything went fine. Now, our client wants to switch to an Oracle DB. When we try to connect now via the Sytem.Data.OracleClient Provider, we get a SecurityException saying:
"Request for the permission of type 'System.Data.OracleClient.OraclePermission, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
during the call of connection.open
Our Assembly has full trust. The DataAccess Layer Assembly is loaded via Unity. All Assemblies are strong named
Any Ideas?
Google gave me just some ASP.NET related stuff.
Problem was, that the main Add-In had full trust, but the dal assembly didn't

Resources