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

Announcements

No record found.

News and Announcements icon
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
    Microsoft Employee 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 202 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 70

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans