I download the CRM SDK 2016 and noticed there is no more Microsoft.Xrm.Client dlls. Do we know why??
So I am using the following URL as a guide to create connection to CRM. https://msdn.microsoft.com/en-us/library/jj602970.aspx
private IOrganizationService orgService;CrmServiceClient conn = newCrmServiceClient(CRMConnectionString); orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : conn.OrganizationServiceProxy;
and then trying to create an account works just fine when running locally on Visual Studio but fails when deployed as a Azure web job with the following message
Object reference not set to an instance of an object.
Looks like it failing on orgService.Create(oEntity); where orgService is null when deployed on Azure but as I said works fine when running it locally as console application.
Entity oEntity = new Entity("account"); oEntity["name"] = "Created from Web Jobs" + DateTime.UtcNow.ToString(); orgService.Create(oEntity);