'How to remove a specific ItemProperty from AppointmentItem.ItemProperties

I use the following method to a new OutlookUserProperty to an AppointmentItem:

MyID = (Outlook.UserProperty)myAppointment.ItemProperties.Add("MyID", Outlook.OlUserPropertyType.olText, false, 1);

... later I want to remove exactly this "MyID" from the ItemProperties collection. Obviously I can only remove an item from the ItemProperties collection using the

myAppointment.ItemProperties.Remove(index).` 

Unfortunately I don't know the index of the element "MyID", and I cannot find any method for retrieving the index of "MyID".



Solution 1:[1]

I think you can use UserProperty.Delete to delete your ItemProperty.

UserProperty up = myMailItem.UserProperties["ParentMailRecipients"];
if(up != null)
  up.Delete();

More info about: UserProperty

Reference: outlook 2007 addin : How to remove particular userproperty of mailItem

Hope it works for you.

Solution 2:[2]

Use PropertyAccessor.DeleteProperty.

To figure out the DASL property name, take a look at the item with OutlookSpy (I am its author - click IMessage button, select the property, look at the DASL property editor).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Simon Li
Solution 2