2

I'm perfectly aware about the threshold thing. I know I need to reduce my query. However, here, it's for a calendar... I use the below query:

<query>
  <Query>
    <Where>
      <DateRangesOverlap>
        <FieldRef Name="EventDate"></FieldRef>
        <FieldRef Name="EndDate"></FieldRef>
        <FieldRef Name="RecurrenceID"></FieldRef>
        <Value Type="DateTime">
          <Month></Month>
        </Value>
      </DateRangesOverlap>
    </Where>
    <OrderBy>
      <FieldRef Name="EventDate" Ascending="ASC"></FieldRef>
    </OrderBy>
  </Query>
</query>

With the below queryOptions:

<queryOptions>
  <QueryOptions>
    <DateInUtc>False</DateInUtc>
    <Paging ListItemCollectionPositionNext=""></Paging>
    <IncludeAttachmentUrls>True</IncludeAttachmentUrls>
    <IncludeMandatoryColumns>False</IncludeMandatoryColumns>
    <ExpandUserField>False</ExpandUserField>
    <ViewAttributes Scope="Recursive"></ViewAttributes>
    <CalendarDate>2014-05-10</CalendarDate>
    <RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>
    <ExpandRecurrence>TRUE</ExpandRecurrence>
  </QueryOptions>
</queryOptions>

My whole list has more than 5,000 events, but for the current month I have only a few of them. I would expect to see the events for the current month without reaching the threshold because we only want the events for the current month, so the query is already limited...

Any solution? (And no, I cannot change the limit of the threshold)

Thanks

1

To be honest I have never used the DateRangesOverlap element.

I hope you have tried it against a calendar with less than 5.000 items to make sure it works correctly.

If it does, then you also need both of the following to be true:

  1. Your list (Calendar) contains <5000 items or it contains >5000 items but your where clause uses an indexed column[1]
  2. The returned results are less <5000 items

I would suggest some experimentation with indexing the columns in your list.

[1] Only the first column you filter by needs to be indexed, the other indexes are ignored

  • Yep it works if I have less than 5,000 items, but stop working from 5,001. In the WHERE clause, as you can see, we have EventDate, EndDate and RecurrenceID. "EventDate"/"EndDate" should be the "Start Time" and "End Time", and they are both indexed. For the RecurrenceID, I guess it is because it's an ID. And yes, the result returned by it is like 10 events. The only way I found is to use another filter, but that's tricky and not good for me. Also I discovered the page "_layouts/CalendarService.ashx" that provides some data without the limitation. I'm working on that solution for now... – AymKdn May 10 '14 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.