Home Refresh Outlook mailitem
Reply: 1

Refresh Outlook mailitem

Mihai Caracostea
1#
Mihai Caracostea Published in 2015-07-01 11:50:43Z

I have created an Outlook addin using NetOffice and it does exactly what it is meant to do: find inline images with broken src attributes (src="cid:somecontent@id") and try to fix them to point to the correct attachments. This is because from an external source, those attributes get messed up, and so do the cids of the attachments. But there is no problem here. The problem is that after the changes are saved to the MailItem, the inspector does not refresh it's view. The changes only get reflected after I restart Outlook, which is by no mean acceptable.

My question is: how can I force Outlook to refresh it's view of the current MailItem?

From what I could find from other Internet resources, Outlook caches that mailitem and because the CIDs are set using Extended Properties, it is not aware of the need to refresh.

Don't know exactly what code bits to post, since the code works fine for what it's intended. This is only a refreshing problem.

Eugene Astafiev
2#
Eugene Astafiev Reply to 2015-07-01 13:12:53Z

That is a known issue. Outlook doesn't propagate changes made through the object model until you re-open the item/inspector and release all references to the object (before re-opening).

Due to the fact that you need to close Outlook you don't release all the underlying COM objects instantly. Typically you need to close the inspector window and release all references (sometimes may be change the selected item in the explorer window).

Use System.Runtime.InteropServices.Marshal.ReleaseComObject to release an Outlook object when you have finished using it. Set a variable to Nothing in Visual Basic (null in C#) to release the reference to the object. See Systematically Releasing Objects for more information.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.31324 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO