Frage

Trying to get event items from a list, I issue a CAML query that only returns a small number of items (about 17). When I set the List View Threshold at 10000 everything works fine, but when I set the LVT at 5000, I get a "Exceeded List View Threshold set by the administrator" error. My CAML query is pretty simple:

<Where>
<And>
    <DateRangesOverlap>
        <FieldRef Name="EventDate" />
        <FieldRef Name="EndDate" />
        <FieldRef Name="RecurrenceID" />
        <Value Type="DateTime">
            <Now />
        </Value>
    </DateRangesOverlap>
    <And>
        <BeginsWith>
            <FieldRef Name="Place" />
            <Value Type="Text">Boston</Value>
        </BeginsWith>
        <Or>
            <Eq>
                <FieldRef Name="Status" />
                <Value Type="Text">Status1</Value>
            </Eq>
            <Eq>
                <FieldRef Name="Status" />
                <Value Type="Text">Status2</Value>
            </Eq>
        </Or>
    </And>
</And>

Can anyone explain why this may be happening? Is is because when expanding recurrences SP actually runs a separate query that result in the LVT being exceeded? Any suggestions to restructure the query would be great, but I do need to look at all occurrences of recurring events (not just the master items).

War es hilfreich?

Lösung

In case anyone is interested, I've managed to play around with the Query and find out how to avoid hitting the threshold. What I did was simply change the order of the query elements so that my indexed fields were listed first and the DateRangesOverlap node was listed last. Here is the result that works:

    <Where>
<And>
    <BeginsWith>
        <FieldRef Name="Place" />
        <Value Type="Text">Boston</Value>
    </BeginsWith>
    <And>
        <Or>
            <Eq>
                <FieldRef Name="Status" />
                <Value Type="Text">Status1</Value>
            </Eq>
            <Eq>
                <FieldRef Name="Status" />
                <Value Type="Text">Status2</Value>
            </Eq>
        </Or>
        <DateRangesOverlap>
            <FieldRef Name="EventDate" />
            <FieldRef Name="EndDate" />
            <FieldRef Name="RecurrenceID" />
            <Value Type="DateTime">
                <Now />
            </Value>
        </DateRangesOverlap>
    </And>
</And>
</Where>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top