Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO?

  • Thread starter Thread starter Michael Schmitz
  • Start date Start date
M

Michael Schmitz

Hello NG,

i made a simple FromRegion Addin where I have a button and a textbox.

When i click on the button in the region i am saving the value in the mail.
So far so good.

Now i want to remove this button from the form Region,
and instead the code in the eventhadler should be executed when
the user clicks on the save Button in the upper right corner of the
Dialog next to the Office Button.

I hope i made it clear what i want ;)

Regards

Michael

Codesnippets:
################################

this._btnSave.Click += new System.EventHandler(this.On_btnSave_Click);



EventHandler ButnSave Click:

private void On_btnSave_Click(object sender, EventArgs e)
{
Outlook.MailItem mail;
Outlook.ItemProperties properties;

try
{

if (this.OutlookItem is Outlook.MailItem)
{
mail = (Outlook.MailItem)this.OutlookItem;
properties = mail.ItemProperties;

// aender den Betreff wie gewuenscht ab
mail.Subject = this._txt1.Text;


mail.Save();
}
}
finally
{
mail = null;
properties = null;
}
}
 
You will need to get a handle to the opened item in the NewInspector() event
of the Inspectors collection, then set up to handle the Write() event of the
opened item.
 
Ken Slovak - said:
You will need to get a handle to the opened item in the NewInspector()
event of the Inspectors collection, then set up to handle the Write()
event of the opened item.

The Problem is that this Write Event only is fired if something has changed
in mail,
if nothing is changed nothing will happen.

So i need a diffrent event to actually make the change in the mail...

Any Ideas?

Regards

Michael
 
That's not what you asked in your original post. Write() fires when the user
clicks Save.

If you want to handle changes in the item you must sink the
item.PropertyChange() and .CustomPropertyChange() events. You can also sink
the Close() event.

You can look at the Object Browser to see what events are available to you
for any type of Outlook item.
 
Ken Slovak - said:
That's not what you asked in your original post. Write() fires when the
user clicks Save.

no it only fires if the user clicks on save AND a mapi field was changed...

well im doing it now diffrent, so i dont need that click event anymore...

Regards

Michael
 
Back
Top