J
j
Hi,
I have shared addIn (.net 2.0, c#)
I add custom fields to mailItem object.
Please have a look in a code snippet below:
......
.......
foreach (XmlNode field in fieldList)
{
fieldName = GetFieldName(field);
fieldValue = GetFieldValue(field);
try
{
AddCustomField(mailItem, fieldName, fieldValue);
}
catch (Exception ex)
{ // log }
}
.....
void AddCustomField(Outlook.MailItem mailItem, string fieldName,
string fieldValue)
{
Outlook.UserProperties ups = mailItem.UserProperties;
SetUserProperty(ups, fieldName, typeof(string), fieldValue);//
adds field to mailItem
Marshal.ReleaseComObject(ups);
ups = null;
}
The question is:
I add a few custom fields to mailItem in a loop, do i need to release
ups (Outlook.UserProperties)?
Can this to destroy com object (mailItem) ??
Thanks in advance.
I have shared addIn (.net 2.0, c#)
I add custom fields to mailItem object.
Please have a look in a code snippet below:
......
.......
foreach (XmlNode field in fieldList)
{
fieldName = GetFieldName(field);
fieldValue = GetFieldValue(field);
try
{
AddCustomField(mailItem, fieldName, fieldValue);
}
catch (Exception ex)
{ // log }
}
.....
void AddCustomField(Outlook.MailItem mailItem, string fieldName,
string fieldValue)
{
Outlook.UserProperties ups = mailItem.UserProperties;
SetUserProperty(ups, fieldName, typeof(string), fieldValue);//
adds field to mailItem
Marshal.ReleaseComObject(ups);
ups = null;
}
The question is:
I add a few custom fields to mailItem in a loop, do i need to release
ups (Outlook.UserProperties)?
Can this to destroy com object (mailItem) ??
Thanks in advance.