outlook 2007 addin : How to remove particular userproperty of mailItem

前提是你 提交于 2019-12-11 00:19:12

问题


I am developing utility application in Outlook 2007

I am able to add User property for Particular mailItem

<i>
  myMailItem.UserProperties.Add("ParentMailRecipients",     Outlook.OlUserPropertyType.olText,true, Outlook.OlUserPropertyType.olText);
            myMailItem.UserProperties["ParentMailRecipients"].Value = SavedMailItem.To + ";" + SavedMailItem.CC;
            myMailItem.Save();
 </i>

After a period of time I need to delete the particular User property.

User Property has the method for removing the user property(Remove(int))

I dont know How to find the index of particular User property and Delete it. Please help me to find solution?


回答1:


You can search retrieve the UserProperty from the UserProperties collection using property name and once you have the UserProperty Object, call Delete method on that.

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


来源:https://stackoverflow.com/questions/8240284/outlook-2007-addin-how-to-remove-particular-userproperty-of-mailitem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!