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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

XrmServiceContext

(0) ShareShare
ReportReport
Posted on by 515

Hi

Im updating some code from 6 to 8.2 / 9

The code I'm updating uses a config file to get the XrmServiceContext

service = new XrmServiceContext(Configuration.xrm);

This is causing an error that I'm finding impossible to find the 8.2 or 9.0 way to upgrade.

Can anyone point me in the right direction?

Thanks

Lee

I have the same question (0)
  • Suggested answer
    Wahaj Rashid Profile Picture
    11,323 on at

    Hi,

    Thank you for your query.

    Is this code a plugin/custom workflow activity?

    If yes, you can get the Organization Service reference from the ServiceProvider:

    IOrganizationServiceFactory serviceFactory =
            (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
        IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

    If you are connecting outside from CRM (a .Net project) using SDK, you need to use CrmServiceClient (instead of XrmServiceContext):

    Sample: Simplified connection quick start (Developer Guide for Microsoft Dataverse) - Power Apps | Microsoft Docs

    Sample code to connect to CDS / Dynamics 365 / CE using OAuth – Nishant Rana's Weblog

  • Wahaj Rashid Profile Picture
    11,323 on at

    Is this issue resolved?

    If yes, please mark the appropriate answer as verified (Click 'Yes' under 'Did this answer your question?').

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 174

#2
ManoVerse Profile Picture

ManoVerse 58 Super User 2026 Season 1

#3
Niki Patel Profile Picture

Niki Patel 42

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans