Hi. I'm currently learning Extending Microsoft Dynamics CRM Online and On Premise Course Module 5 Using the Organization Service.
I'm simply following the steps according to the lab documentation. The code should be perfectly working but it doesn't work for me.
Connection Strings:
<connectionStrings><add name="CRMOnline" connectionString="Url=xxxxx.crm5.dynamics.com; Username=xxxxx@xxxxx.onmicrosoft.com; Password=xxxxx;"/></connectionStrings>
The connection :
CrmConnection con = new CrmConnection("CRMOnline"); IOrganizationService service = new OrganizationService(con); WhoAmIRequest req = new WhoAmIRequest(); var result = service.Execute(req) as WhoAmIResponse; if (result != null) { Console.WriteLine(String.Format("Organization ID: {0}\nBusiness Unit ID: {1}\nuser ID:{2}", result.OrganizationId, result.BusinessUnitId, result.UserId)); Console.ReadLine(); }
The exception is caught in this line : var result = service.Execute(req) as WhoAmIResponse; Innerexception said "Invalid Request".
- I have made sure the credentials on connectionStrings are correct multiple times
- I think I have already synchronized the date & time for my pc and the CRM (synchronized internet time & selected the correct time zone on both PC & CRM. Even tested created a record & checked date&time created is correct.)
What else could cause this error?
Thank You.