1

Is there a way to programmatically check a booking if already exist in sharepoint calendar?

I am saving recurring entries programmatically using the xml rule for recurrence as per this, for recurring entries I want to check if any entry exist for the same date time.

If I do ExpandRecurrence and fetch all the entries within the start and end date of the current event than how will I check if the current item I want to save will fall within that range?

Kindly explain how to go about the same.

0

With JavaScript and jQuery you can query your calendar for conflicting events Events and Possible Overlap Situations

Based on this image, the 'Event' needs a query that finds Events A,B,E and F (C and D don't Overlap 'Event')

  • Start of Other Events are with the Start and End of this Event
  • End of Other Events are with the Start and End of this Event
  • Start of Other Events is less the Start of this Event and End of Other Events is greater then the End of this Event

To the code:

sd = CurrentEventStart.toISOString(), ed = CurrentEventEnd.toISOString();

Start Dates With-in: (note use of sd and ed)

(StartDate+ge+datetime'"+sd+"'+and+StartDate+le+datetime'"+ed+"')+or+

End Dates With-in: (note use of sd and ed)

(OData__EndDate+ge+datetime'"+sd+"'+and+OData__EndDate+le+datetime'"+ed+"')+or+

Overlapping Events: (Starts prior and Ends after) 'Event B' in image

(StartDate+le+datetime'"+sd+"'+and+OData__EndDate+ge+datetime'"+ed+"')

Last you will want to exclude the current event (if it is an edit form):

+and+ID+ne+'CurrentEventID'

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.