web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to resolve Error on creating IOrganizationService Instance

(0) ShareShare
ReportReport
Posted on by 8

In the below code I am getting two errors at orgServiceManagement, newtoken

IServiceManagement<IOrganizationService> orgServiceManagement =ServiceConfigurationFactory.CreateManagement<IOrganizationService>(new Uri(""));
AuthenticationCredentials authCredentials = new AuthenticationCredentials();
authCredentials.ClientCredentials.UserName.UserName = "";
authCredentials.ClientCredentials.UserName.Password = "";
AuthenticationCredentials newtoken = orgServiceManagement.Authenticate(authCredentials);
OrganizationServiceProxy oproxy = new OrganizationServiceProxy(orgServiceManagement, newtoken);
oproxy.EnableProxyTypes();
IOrganizationService service = (IOrganizationService)oproxy;
return service;

 Argument 1: cannot convert from 'Microsoft.Xrm.Sdk.Client.IServiceManagement<Microsoft.Xrm.Sdk.IOrganizationService>' to 'Microsoft.Xrm.Sdk.Client.IServiceConfiguration<Microsoft.Xrm.Sdk.IOrganizationService>' 

Argument 2: cannot convert from 'Microsoft.Xrm.Sdk.Client.AuthenticationCredentials' to 'Microsoft.Xrm.Sdk.Client.SecurityTokenResponse'.

these are two errors, I am getting.

Please let me know if some has a solution or any other alternate code to create instance for IOrganizationService

Thanks in Advance.

I have the same question (0)
  • Suggested answer
    Tarcisio Vilas Boas Profile Picture
    on at

    Hey Phanikumar,

    Please, try to follow this sample using CrmSericeClient: docs.microsoft.com/.../sample-simplified-connection-quick-start.

    Following this sample, you will be able to create a connection to D365.

    Hope this helps you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans