I am currently trying to add a custom property to an appointment in Exchange via EWS. Unfortunatley I am little stuck here.
I found examples for C# and VB but I cannot connect the dots to make it work in powershell even though I am pretty far, I think/hope.
Connecting, binding, viewing and editing existing items and their properties all works fine but I cannnot find a way to add a custom field/property to an calendar item.
Here is what I found so far (as I said no PS):
Any help is appreciated. Thanks!
Thanks for the response. Turns out I really was close.
As I said, I had been able to create an appointment.
To add a custom property to this appointment, you have to create an ExtendedPropertyDefinition-object, which requires a GUID:
$myGUID = [GUID]"32ed071d-932e-487e-ad14-cde3272cfcc7"
$myProperty = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(`
$myGUID,` # property GUID
"myProperty",` # property name
[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::string` # property type
Then you can use the SetExtendedProperty-method of the existing appointment, to add an instance of the defined property to the appointment:
$appointment.SetExtendedProperty($myProperty,"This is my String")
Finally you update the appointment:
I found everything I had been missing here: