Good afternoon,
I'm creating a class that connects to CRM On Line version v.9.2, but I'm getting the error "Unable to Login to Dynamics CRMOrganizationServiceProxy is null", can someone help me, below is the code I'm using
D365ConsoleCRUD namespace
{
class Program
{
static void Main(string[] args)
{
OAuthConnexion connection = new OAuthConnexion();
CrmServiceClient svc = connection.ConnectionOAuth();
if(svc.IsReady)
{
Console.WriteLine("With Connection");
}
else
{
Console.WriteLine("No Connection");
}
}
}
}
public class OAuthConnection
{
public CrmServiceClient ConnectionOAuth()
{
string url = "">xxxxxx.crm2.dynamics.com";
string userName = "xxxx@hotmail.com";
string passWord = "xxxxx";
string con = $@"
Url = {url};
AuthType = Office365;
userName = {userName};
passWord = {passWord};
RequiredNewInstance = True";
CrmServiceClient svc = new CrmServiceClient(con);
return svc;
}
}
Hello Arshad,
Thanks for the feedback, I tried your way and failed, I tried from the article optimallogics.com/.../ , but success.
Create the connection string and nothing, I believe that it is missing some parameter.
Here's the code I'm using
Void main:
using (CrmServiceClient svcClient = new CrmServiceClient(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
if (!svcClient.IsReady)
{
Console.WriteLine("unable to connect!");
return;
}
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse response = (WhoAmIResponse)svcClient.Execute(request);
Console.WriteLine("UserId =" + response.UserId.ToString());
}
APP Config:
<connectionStrings>
<add name="ConnectionStrings"
connectionString="
AuthType=ClientSecret;url=XXXXX.crm2.dynamics.com;
ClientID=XXXXXX-126c-XXXX-a87b-XXXXXX;
ClientSecret='XXXX-XXXX-XXXX-aceb-XXXXXX"/>
</connectionStrings>
The error I'm getting is
Object reference not set to an instance of an object
Thanks
Hi,
https://juniorazurecrm.blogspot.com/ you can also find code and explanation here.
www.youtube.com/watch This video tell you how to create record in crm once the authentication done.
please like and subscribe my YouTube channel and blog for interview question.
https://www.youtube.com/watch?v=X7H25FZHoF0&t=3s
https://juniorcrmblog.blogspot.com/
Thanks,
Arshad
Thanks
Hi Shaun,
How is everything? Thanks for replying, do you have an example using this command?
Hi Ricardo,
You are still using an Office365 AuthType which has now been deprecated.
You now need to use an AuthType = OAuth and a modified connection string.
See the deprecation note from Microsoft below.
Hopefully modifying the connection string should allow you to connect.
Regards,
Shaun
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... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156