Reputation: 11
An .msg file from anywhere in the file system is opened in Outlook. How can you determine the complete file name in a VSTO add-in?
Is there perhaps a special property that can be accessed via PropertyAccessor?
I'm desperate.
I've searched all sorts of things with the great OutlookSpy tool, but to no avail.
Upvotes: 0
Views: 38
Reputation: 66215
No, once a message is opened, there is no trace that it came from the file system. More than that, Outlooks does not use the original IMessage
object returned from OpenIMsgOnIStg
, but rather creates a temporary message in the Outlook default message store; that's the message the user interacts with.
Upvotes: 0
Reputation: 11
MSG file, for example (C:\something\message.msg) is opened with a double click, the event handler starts successfully
private void Inspectors_NewInspector(Inspector inspector)
{
if (inspector.CurrentItem is MailItem)
{
MailItem mailItem = inspector.CurrentItem as MailItem;
System.Diagnostics.Debug.WriteLine(mailItem.FileName_xyz_Propety); // <<-- Unfortunately that or something similar doesn't work
mailItem.Subject += " " + DateTime.Now; // Change Subject for Test
mailItem.Save(); // File with change in subject successfully written back to the file system.
}
Upvotes: 0