I want to retrieve the occurrence (ItemID) from a recurring master calendar event on a specific date (I have the date of the occurrence and the recurring master event data).
I was trying FindItem with a restriction like this
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
</soapenv:Header>
<soapenv:Body>
<mes:FindItem Traversal="Shallow">
<mes:ItemShape>
<typ:BaseShape>AllProperties</typ:BaseShape>
</mes:ItemShape>
<mes:Restriction>
<typ:IsEqualTo>
<typ:FieldURI FieldURI="item:RecurringMasterItemId"/>
<typ:FieldURIOrConstant>
<typ:Constant Value="AQMkAD[snip]AAAAA=="/>
</typ:FieldURIOrConstant>
</typ:IsEqualTo>
</mes:Restriction>
<mes:ParentFolderIds>
<typ:DistinguishedFolderId Id="calendar"/>
</mes:ParentFolderIds>
</mes:FindItem>
</soapenv:Body>
</soapenv:Envelope>
but this returns:
The 'FieldURI' attribute is invalid - The value 'item:RecurringMasterItemId' is invalid according to its datatype (types:UnindexedFieldURIType) - The Enumeration constraint failed.
(I also know the ChangeKey for the recurring appointment and tried that, with the same error)
How should this be fixed to make it work?
BTW. I know about retrieving occurrences with GetItem like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
</soapenv:Header>
<soapenv:Body>
<mes:GetItem>
<mes:ItemShape>
<typ:BaseShape>IdOnly</typ:BaseShape>
</mes:ItemShape>
<mes:ItemIds>
<typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="1"/>
<typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="2"/>
<typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="3"/>
</mes:ItemIds>
</mes:GetItem>
</soapenv:Body>
</soapenv:Envelope>
Then, I could retrieve StartDate and loop through them, but there is no way I can predict the InstanceIndex range that might apply.
Thanks in advance,
Jan
It does not look like this is possible.
I have now resorted to using GetItem, retrieving 50 occurrences at a time.
This returns a list of GetItemResponseMessages containing either:
Succesful occurrence retrievals
ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange responsecode indicating that we have reached the last occurrence
Other 'real' errors
ErrorCalendarOccurrenceIsDeletedFromRecurrence responsecode indicating that the occurrence was deleted
So I just loop until I have found the proper date, reached ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange, or reached a maximum number of calls set in my code.