How to change mail path in outlook

  • Thread starter Thread starter Ashish
  • Start date Start date
A

Ashish

In outlook addin if we save a mail (mailitem->Save) then outlook generates
an event for saving this mail which we get on exchange server in OnSyncSave.
If we saved a mail under inbox folder (say ..Inbox/mail.eml) then we'll get
same path in onsyncsave.

But when we change subject of a mail and save this, outlook generates path
for old subject mail for example
if mail subject under inbox is mail1. We change subject to mail2 and save
this mail then outlook generates path as ..Inbox/mail1 which is wrong. It
should be ..Inbox/mail2.
Also if we have a mail with subject mail1 under drafts folder and we create
a new mail with same subject and save in drafts folder, outlook generates
path as ..Drafts/mail1 which it should be ..drafts/mail1-2. And sometimes
outlook generates path for this mail in Sync Issue folder.

Can we handle this in outlook addin? Does outlook addin allows to generate
correct path? If yes please give any example.
 
In an Outlook addin you can handle Inspectors.NewInspector() to know when an
item has been opened. You can then handle any event on that Inspector, or by
using Inspector.CurrentItem, any event on the item. You usually set up the
event handlers in the initial Activate() event of the Inspector.

Saving an item fires item.Write().

If the item hasn't been opened but was edited in the folder view (Explorer)
using in-cell editing then you'd have to handle Explorer.SelectionChange()
on the ActiveExplorer() object, then instantiate event handlers for each
member of that Selection collection.
 
Thanks for reply. I'm doing same as you explained. Lets take the case when
open a mail.
I'm handling in Inspectors.NewInspector and accessing it using
Inspector.CurrentItem.

Suppose there is a mail in draft folder. After opening mail i change its
subject and save this mail. After saving outlook generates path for old
subject mail. Same think happen if a folder contains a mail with some
subject and i create new mail with same subject in same folder.
In all above cases i'm accessing current mail using Inspector.CurrentItem.
But outlook generates path for another mail while it was not open.
Please explain what to do. Sorry i could not get you properly.
 
I don't really follow what your problem is. Subject is never a good way to
track anything anyway. If an item is saved, which you can check, use the
EntryID as the unique identifier for that item, that's what it's there for.

If you have a reference to Inspector.CurrentItem then that is a fixed
reference, it doesn't relate at all to any other item open in any other
Inspector. I fail to see how they can be confused.
 
I'm not doing anything with subject. I was using subject keyword for
folowing purpose
If we open a mailsave any mail item, we access it using
inspector.currentitem and save this mail (mailitem->Save() method) then
outlook generates a path which we get in OnSyncSave. This path contains mail
location in its folder like ..Inbox/mailsubject.eml
Before saving mail i did not change subject.
Here my question is
If any other mail (having same subject) is also there in same folder then we
get the path for old mail in onsyncsave while we did not open/access old
mail.

To generate correct path before saving mail i change many fields of current
mail but still onsyncsave shows path for another mail.
 
If your problems are with what's being returned by OnSyncSave as a folder
event sink then it's not an Outlook problem but a problem in the event sink.
I'd post about this in an Exchange development group. There's not much on
the Outlook end that you can do to fix what's coming in from that event
sink.
 
I don't post event sinks. I said to post in an Exchange development group
about that since your problem is with your event sink, not with Outlook.
 
Back
Top