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 6804149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:25:50+00:00 2026-05-26T19:25:50+00:00

I am trying to filter data by the EntityReference with no luck. Without the

  • 0

I am trying to filter data by the EntityReference with no luck. Without the where clause it runs fine with the where clause I get the following error:

The server did not provide a meaningful reply; this might be caused by
a contract mismatch, a premature session shutdown or an internal
server error.

Here is my method that calls the CRMService:

/// <summary>
        /// Gets the categories.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<category> GetCategoriesExcludingSomething()
        {
            IEnumerable<category> data = CrmClient.categorySet.OrderBy(x => x.SubCategory).ThenBy(x => x.itf_name);

            return data.Where(x => x.SubCategory.ToString() == "SomethingToExclude");
        }

I have tried using SubCategory.Name also but it gives the same error. I think it’s related to the fact it uses early binding or something along those lines but I couldn’t get any useful information when debugging.

Any advice or help would be great, this should be easy :/

  • 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-26T19:25:51+00:00Added an answer on May 26, 2026 at 7:25 pm

    According to this documentation: http://technet.microsoft.com/en-us/library/gg328328.aspx

    The LINQ query provider supports a subset of the LINQ operators. Not
    all conditions that can be expressed in LINQ are supported.

    orderBy
    supports ordering by entity attributes, such as Contact.FullName.

    What you could do is to use the where clause first, and then use the ToList() method. After this, you’ll have a collection of data on which you can use all the common Linq queries.

    Also, trying to OrderBy an EntityReference is not the good way to do it. You should try ordering like this:

    OrderBy(x => x.SubCategory.Id)
    

    where: The left side of the clause must be an attribute name and the right side of the clause must be a value. You cannot set the left side to a constant. Both the sides of the clause cannot be constants.
    Supports the String functions Contains, StartsWith, EndsWith, and Equals

    What you could do here is either filtering values by the Id or by the Name (that’s the only relevant informations you’ll have from the EntityReference in this case).

    Where(x => x.SubCategory.Name == "CategoryNameToExclude");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to POST data back to the server and get a dataset
I'm trying to filter data from one workbook to another obne, but I get
Trying to build up a query to filter on data in the following manner
I'm trying to Integrate HTML Purifier http://htmlpurifier.org/ to filter my user submitted data but
I'm trying to filter a list of elements via ':not()', and jQuery seems to
I am trying to implement Ext.ux.grid.filter.ListFilter using a data store (rather than a hardcoded
I am trying to filter data in the dojo grid widget, however, I am
I'm trying to filter certain data from an HTML file. For example, the HTML
In asp.net, i am trying to filter the data in datatable for that i
I am trying to filter my query data to only return items where Meeting

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.