Outlook Add-In: event when email is moved through inspector - c#

I need to change the category of a email when the inspector-window is closing - what I am doing with the Close event.
My problem is, if the user clicks "move to folder" in the inspector, the mail is moved, after this the close event is fired, but at this point I coannot change the mail any more, because it was changed trough the mail-move (eg: EntryID gets changed).
Any ideas?
An "before-Item-moved" event on the mail would be great - or a way to reload the changed mail.

Unfortunately there's no easy way to get folder that the email was moved to. Which means you'll have to use Redemption which has events for the RDOStore object that can detect changes to any folder. But you'd also have to monitor EVERY store, because the user can obviously move it anywhere. And because the EntryID has changed, you'd need to use PR_SEARCH_KEY as the unique identifier in order to even find the email and then apply the category to it. Not fun!
Another option may be to repurpose the Move To Ribbon button to intercept the move operation, but then you'd have to provide your own folder picker! Ugly!

There is a BeforeMove event available:
https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspectorevents_10_event.beforemove%28v=office.14%29.aspx

Related

How to get save confirmation dialog result of outlook

I don't know how to get result of save confirmation dialog of outlook (in C#).
This confirmation box is opened up by following:
Open mail in outlook
Made some changes in content
Close the mail
Please refer this image
I want to get this opened save confirm box and its result.
Thanks in advance.
Track the MailItem.Close / Write / AfterWrite events - Close will fire immediately before the prompt is shown, Write fires before the message is saved, AfterWrite immediately afterward.
There is no trivial way of getting such information. But you may track the sequence of events fired for the item and realize the answer following that way.
First, to handle item-level events you may develop a wrapper for an Outlook item like described in the Implement a wrapper for inspectors and track item-level events in each inspector article.
The MailItem.Close event is fired when the inspector associated with an item (which is an instance of the parent object) is being closed.
The MailItem.Write event is fired when an instance of the parent object is saved, either explicitly (for example, using the Save or SaveAs methods) or implicitly (for example, in response to a prompt when closing the item's inspector).
So, if you have got Close fired following by the Write event - that is your case!

How to identify from where the contextItemDoubleClick event triggers

I want to identify from where the ContextItemDoubleClick event is triggering in enterprise architect . (For eg) if i double click on a project browser in EA i need to identify it was triggered from project browser , because now ContextItemDoubleClick is triggering whenever user doubleclicks inside EA . Is it possible to identify that it triggers from project browser or open diagram or diagram object ?
No, you can't. At least not from EA:
This event occurs when a user has double-clicked (or pressed the Enter key) on the item in context, either in a diagram, in the Project Browser or in a custom compartment. Add-Ins to handle events can subscribe to this broadcast function.
You won't likely analyze the current screen contents and make a guess where the mouse cursor is positioned, will you?
Ask yourself (or tell us) why you want to do that to find some alternative solution for your underlying issue.

PropertyChange not fire on Reading Panel when I reply or forward email on Office 2013

I am using Add-in Express(v 7.6.4084) to create an Outlook plugin.
The problem is, that the MailItem.PropertyChange isn't triggered when reply an email on reading panel.
I have searched several topics but wasn't able to find a solution.
Seems you are talking about the inline response feature. If so, you need to use the ActiveInlineResponse property to get an item object representing the active inline response item in the explorer reading pane. It fires the PropertyChange event as expected on my PC with Outlook 2013 installed.
Note, you need to declare the source object at the global scope to prevent it from being swiped by the garbage collector.

C# VSTO Outlook 2007 / Sharepoint: AddIn wont save contact item

can somebody help: i have an AddIn which reads contacts from a Sharepoint Server.
The user can load a contact and make some changes or create a new one. At his point, saving the item works well. The Form closes and the item is beeing transfered to Sharepoint.
But if the user reopens the same contact again and trys to make a simple change, saving is no more possible: The element could not be saved because it was changed by another user or window. Would you like to place a copy in your standard folder" (this a my translation from german to english...) The user must restart Outlook to make his change! I dont know, why the "fxxx" this happens.
I hook into the "Write" event to check some rights and if all is ok i do a
Marshal.ReleaseComObject(item);
this.Dispose();
and call the Garbage Collector:
GC.WaitForPendingFinalizers();
GC.Collect();
Even i write these lines into the FormRegionClosed-Method the problem stays the same.
Yeehaaaa: found the problem!
in AddIn-Startup a have an event handler for setting the message class on the current item.
This item has to be Marshall'd too

event handler problems c#

I have a handle that fires when the ItemAdd event is triggered on the Sent Items folder in outlook. This handle prompts the user and depending on their selection then opens a custom windows form to save the sent email.
Now ... heres what happens ...
The prompt shows fine when an item is placed into the Sent Items folder, if you dismiss it it will show again fine the next time the event is triggered, and so on.
If you accept the prompt, the windows form shows and are able to save the email. But the next time an email is placed into the sent items folder the event doesnt fire, and hence the prompt doesnt even show!
if i put the same handle on Outlooks OnSend event instead of on the ItemAdd for the sent items folder all works just the same, except after the windows form is loaded the first time it will continue to be loaded (ie the event fires and is handled) perfectly the next time you want it to.
It appears showing the windows form for some reason causes either the event to stop firing or the handle to drop off the sent items folder (but only the sent items folder). The latter being more likely i think. I have an idea for a work around but im not really a fan of work arounds if i can get away with it.
Would anybody know what might be going on here?
Many thanks in advance to any thoughts people may have.
Cheers,
Stuv
I had a similar problem. It sounds like one of your variables is getting garbage collected. If you can post some code I might be able to help you.

Categories