Copy link to clipboard
Copied
I am writing a process that loads an office 365 exchange calendar from an external database. I have the functionality working. Howver, it is not efficient. I am looping through several hundred records similar to:
<cfloop query="myQuery">
<cfset myEvent = StructNew()>
<cfset myEvent.AllDayEvent = "no">
<cfset myEvent.Subject = "#mySubject#">
<cfset myEvent.StartTime = "#myStartTime#">
<cfset myEvent.EndTime = "#myEndTime#">
<cfset myEvent.Message = " "#myMessage#"">
<!--- Create Event --->
<cfexchangecalendar action="create" connection="testconn1" event="#myEvent#" result="theUID">
</cfloop>
This is working, however it is slow and sometimes i get: "The request has exceeded the allowable time limit" I do not want to up the time limit. I would like, however, to make this process faster. I am almost 100% positive the bottleneck is the fact that I am creating the event hundreds of times, rather than once. The query called is very fast and only run once. Is it possible to pass multiple events to the cfexchangecalendar create tag rather than one event at a time? Or, does anyone have any suggestions for making this process run quicker?
Where are the specifications for the structure we pass to the cfexchangecalendar via the event variable?
Thanks
Copy link to clipboard
Copied
wannab0133 wrote:
I am almost 100% positive the bottleneck is the fact that I am creating the event hundreds of times, rather than once.
It all depends on what you want. Here you talk of 'the' event, whereas your code is actually creating hundreds of events, one for each row of the query.
For contents of the event structure, scroll to the section, 'The create action', in the documentation on cfexchangecalendar. It says you can only pass one event structure at a time per cfexchangecalendar tag. So, if creating one event per row is indeed what you seek, the approach you have used is the most efficient. At least, as far as I understand it.
Nevertheless, there is one way to make the page end tidily. Close the connection, for example, by adding the following line after the loop:
<cfexchangeConnection action="close" connection="testconn1">
Copy link to clipboard
Copied
Thanks for the info. I missed the create action section. My issue is that I have 60 people and several hundred events per person. This thing times out half way through the first person. So, I think I am going to have to load the calendar once with all the events, then only update the modified or removed events. I was hoping to mirror the database of events on the exchange calendar, and update every hour or so. I am basically going to have to synchronize the events.
Copy link to clipboard
Copied
Anyone have any ideas on how to synchronize an exchange calendar with an external database of events? It is too slow to take the events and load them one by one into exchange for all users. I do not have control over the application that creates the events, just the database that the events are stored in.