Sharing a sample code that can be used to connect to CRM 2011 online with Office 365.
// Add refereneces to the following dll
// microsoft.crm.sdk.proxy
// microsoft.xrm.sdk
// system.runtime.serialization
// system.servicemodel
IServiceManagement<IOrganizationService> orgServiceManagement =
ServiceConfigurationFactory.CreateManagement<IOrganizationService>(new Uri("https://democrm.api.crm5.dynamics.com/XRMServices/2011/Organization.svc"));
AuthenticationCredentials authCredentials = new AuthenticationCredentials();
authCredentials.ClientCredentials.UserName.UserName = _userName;
authCredentials.ClientCredentials.UserName.Password = _password;
AuthenticationCredentials tokenCredentials = orgServiceManagement.Authenticate(authCredentials);
OrganizationServiceProxy organizationProxy = new OrganizationServiceProxy(orgServiceManagement, tokenCredentials.SecurityTokenResponse);
Guid userid = ((WhoAmIResponse)organizationProxy.Execute(new WhoAmIRequest())).UserId;
Sample Code – Dynamics 365 Web API / Organization Service
Bye.
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

Asking questions are truly pleasant thing if you are not
understanding anything entirely, except this post provides
pleasant understanding even.
LikeLike
Hi,
I tried this connecion to CRM online 2015 with office 365 and i get the error: Value cannot be null.\r\nParameter name: identityProvider
at object:
AuthenticationCredentials tokenCredentials = orgServiceManagement.Authenticate(authCredentials);
Do you have any idea
LikeLike