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

  • Home
  • SEARCH
  • 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 8693771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:37:12+00:00 2026-06-13T00:37:12+00:00

I am trying to query the OData using .net client to get the Last

  • 0

I am trying to query the OData using .net client to get the Last Published components within a specific DateTime. It is always failing with an exception 'datetime' is not property of entity: 'com.tridion.storage.ComponentMeta'

var lastPubComponents = _client.Components
                               .Where(p => p.PublicationId == sitePubId && p.LastPublishDate > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss")))
                               .ToList();

When I checked the constructed Odata URL it looks like the following and I tried with the same URL from browser just to double check I got the same error which is expected.

Odata URL when I tried with LINQ

/cd_webservice/odata.svc/Components?$filter=PublicationId eq 59 and LastPublishDate ge datetime'2012-10-11T09:22:14'

I tried by removing the datetime string from the above URL and checked from browser again. This URL is working as expected and I am getting the correct results.

Below is the URL (working w/out datetime)

/cd_webservice/odata.svc/Components?$filter=PublicationId eq 59 and LastPublishDate ge '2012-10-11T09:22:14'

That kind of leads me thinking it is something wrong with LINQ and/or .net client combination.

I tried playing with different Datetime format combinations and I get the same error. When I checked Odata standard it is suggesting to use datetime string but that is the one I am having issues with.

Anybody knows how to debug/resolve this from LINQ code ? Any help will be greatly appreciated.

  • 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-06-13T00:37:14+00:00Added an answer on June 13, 2026 at 12:37 am

    The OData specs do mention the possibility to query with constructs like “LastPublishDate ge datetime’2012-10-11T09:22:14′” in http://www.odata.org/documentation/overview#AbstractTypeSystem but this was not implemented into the product. However, in the product are the date methods allowed by OData specs for filtering (http://www.odata.org/documentation/uri-conventions#FilterSystemQueryOption). These are day(), hour(), minute(), month(), second() and year() and this basically translates into a nightmare query for you:

    DateTime timeNow = DateTime.Now;
    int yearNow = timeNow.Year;
    int monthNow = timeNow.Month;
    int dayNow = timeNow.Day;
    int hourNow = timeNow.Hour;
    int minuteNow = timeNow.Minute;
    int secondNow = timeNow.Second;
    var lastPubComponents = service.Components
         .Where(p => p.PublicationId == 3 && 
                (p.LastPublishDate.Value.Year > yearNow || 
                  (p.LastPublishDate.Value.Year == yearNow && p.LastPublishDate.Value.Month > monthNow) ||
                   (p.LastPublishDate.Value.Year == yearNow && p.LastPublishDate.Value.Month == monthNow && p.LastPublishDate.Value.Day > dayNow) ||
                   (p.LastPublishDate.Value.Year == yearNow && p.LastPublishDate.Value.Month == monthNow && p.LastPublishDate.Value.Day == dayNow && p.LastPublishDate.Value.Hour > hourNow) ||
                   (p.LastPublishDate.Value.Year == yearNow && p.LastPublishDate.Value.Month == monthNow && p.LastPublishDate.Value.Day == dayNow && p.LastPublishDate.Value.Hour == hourNow && p.LastPublishDate.Value.Minute > minuteNow) ||
                   (p.LastPublishDate.Value.Year == yearNow && p.LastPublishDate.Value.Month == monthNow && p.LastPublishDate.Value.Day == dayNow && p.LastPublishDate.Value.Hour == hourNow && p.LastPublishDate.Value.Minute == minuteNow && p.LastPublishDate.Value.Second > secondNow)
                  )
                 )
         .ToList();
    

    Hope this helps.

    Regards,
    Daniel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to query a WCF OData service from Java using the odata4j
I’m trying to get some code working using OData. The following bit of code
I'm trying to query a .NET DateTime property and compare it with a date
I'm trying to query for a specific vote within the vote_fu plugin so that
I am trying to use the Netflix OData API. I wanted to query all
Trying to query a 'Favorites' model to get a list of items a user
I am trying to query some tables in my database using a simple dropdown
I'm trying to query a MySQL database using an array but I'm having trouble!
I am trying to query the windows desktop search API using SQL. I have
I'm experimenting with LINQPad to use LINQ to query the Netflix OData. I'm trying

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.