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 :
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,321 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,321 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

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 > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 74

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans