Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6935021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:02:47+00:00 2026-05-27T12:02:47+00:00

I am using a FetchExpression against a RetrieveMultiple operation on a CrmOrganizationServiceContext within a

  • 0

I am using a FetchExpression against a RetrieveMultiple operation on a CrmOrganizationServiceContext within a windows service to fetch and process items out of a queue.

The first time this runs this fetches the items to be processed correctly. On subsequent calls using the same CrmOrganizationServiceContext instance it always retrieves zero entities with no errors thrown. I have added in new entities and reactivated existing ones that should be fetched using the FetchXml and they aren’t retrieved.

As soon as I restart my service it creates a new instance of the CrmOrganizationServiceContext and fetches the new items.

What am I doing wrong here?

   public CrmConnector(string connectionString)
   {
        Context = new CrmOrganizationServiceContext(CrmConnection.Parse(connectionString));
   }

   public void FetchStuff()
   {
        string fetchXml = "...";
        FetchExpression fetchExpression = new FetchExpression(fetchXml);
        EntityCollection entityCollection = Context.RetrieveMultiple(fetchExpression);
        // entityCollection.Entities is always empty following first run
    }

    private CrmOrganizationServiceContext Context { get; set; }

Fetch Xml as requested, the only customisation is the count attribute which limits the number of items being returned (as this is a queue processor)

  <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" count="10">
    <entity name="xxx1">
      <attribute name="xxx_name" />
      <attribute name="createdon" />
      <attribute name="xxx_1" />
      <attribute name="xxx_2" />
      <attribute name="xxx_3" />
      <attribute name="xxx_4" />
      <attribute name="statecode" />
      <order attribute="createdon" descending="false" />
      <filter type="and">
        <condition attribute="xxx_exported" value="0" operator="eq"/>
      </filter>
    </entity>
  </fetch>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:02:48+00:00Added an answer on May 27, 2026 at 12:02 pm

    It is the CrmOrganizationServiceContext that is doing the caching – I found the following worked a treat and the results of my RetrieveMultiple are no longer cached 🙂

    Context = new CrmOrganizationServiceContext(CrmConnection.Parse(connectionString));
    Context.TryAccessCache(cache => cache.Mode = OrganizationServiceCacheMode.Disabled);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using jQuery, one can easily find out whether a particular element is visible using
Using Core Data, I have a fetch request to fetch the minimum of a
Using gcc and ld on x86_64 linux I need to link against a newer
Using restlet, I want to make a post to android's c2dm service. I have
Using Django, how do I generate the value of a field the first time
Using Visual C++ 2008. First time, I'm experimenting in crossing over from C# and
Using online interfaces to a version control system is a nice way to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.