Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

[E2010] [EWSMA] [PS / C#][Windows] How to Consolidate appointment creation / modification / deletion?

$
0
0

Hello fellow forum dwellers,

 

I have created a working calendar sync utilizing EWS 1.2 on Exchange 2010 SP1 (the other end of the sync is a foreign product and of no concern, as that part works perfectly and isolatedly).

Now I am working on matters of scaling. Loading appointments is a fairly straightforward operation, but so far I have only been able to create, change or delete appointments with an individual operation per appointment, by using the respective method of the appointment class (.set / .update / .delete).

Is there any way to apply multiple such operations in a single operation?

 

Thanks in advance and best regards,

Fred

p.s.: Here's what I do. I do it in PowerShell and abbreviated it in the example to the cmdlet calls for the parts that already work perfectly:

# Load the EWS managed Api
Import-Module EWS

# Create the ExchangeService
$service = Get-EWSService -fqdn <fqdn of the Exchange server>

# Load the proper calendar folder
$folder = Get-EWSFolder -service $service -IDString <ID string of folder>

# Load the appointments
$appointments = Get-EWSAppointments -folder $folder -from $from -to $to -service $service

# Calculate the changes necessary
$updates = Process-Appointments -appointments $appointments

# $updates is an array of custom PSobjects, they have basically two relevant properties:
# .Appointment #Appointment Object
# .Operation #String-Value, either "New", "Update" or "Delete"

# Apply the changes
foreach ($update in $updates)
{
    if ($update.Operation -eq "New"){$update.Appointment.Set()}
    elseif ($update.Operation -eq "Update"){$update.Appointment.Update()}
    elseif ($update.Operation -eq "Delete"){$update.Appointment.Delete()}
}


Viewing all articles
Browse latest Browse all 7132

Trending Articles