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

Odata Connection String Error

(0) ShareShare
ReportReport
Posted on by 95

i am using below code:-

CrmServiceClient conn = new CrmServiceClient("Url=myorg.crm6.dynamics.com; Username=XXXXX@XXXXX.com; Password=XXXXXX; authtype=Office365"); IOrganizationService orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

But i am gatting this error.

'The entity with a name = 'entityname' with namemapping = 'Logical' was not found in the MetadataCache. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=706071, MinActiveRowVersion=706071, 

Please suggest me a best solution

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Recommendation 1 - don't use OrgServiceProxy because it's going away and your code will start failing. CrmServiceClient implements IOrganizationService interface so there is no point in your getting of OrgService. Here is the code you can use:

    IOrganizationService orgService = new CrmServiceClient("Url=myorg.crm6.dynamics.com; Username=XXXXX@XXXXX.com; Password=XXXXXX; authtype=Office365");

  • Altaf Haider Taqvi Profile Picture
    95 on at

    Hi Andrew,

    I used your code but i am still geting same error.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    When do you get that error?

  • Altaf Haider Taqvi Profile Picture
    95 on at

    when, i retrieve custom entity records, then i am getting this error. but with business entities it's working well.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Can you please provide your code?

  • Altaf Haider Taqvi Profile Picture
    95 on at

    #region OData Connection String

               var connectionString = ConfigurationManager.AppSettings["connectionString"];

               CrmServiceClient conn = new CrmServiceClient(connectionString);

               //IOrganizationService _service;

              IOrganizationService servce = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

               //OrganizationServiceContext _Con;

               OrganizationServiceContext _Context = new OrganizationServiceContext(servce);

               ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

               [tag:endregion]

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I don't see the code that retrieves custom entity records here.

  • Altaf Haider Taqvi Profile Picture
    95 on at

    Above code was for connection.

    i am using this code for retrieve records.

    var data = (from _obj in orgContext.CreateQuery<xrm_internalticket>()

                           select new { _obj.Attributes }).FirstOrDefault();

  • Altaf Haider Taqvi Profile Picture
    95 on at

    6036.Error.png

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Ok. Try to use the trick suggested here - bettercrm.blog/.../

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 103 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 83

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans