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
Status
Not open for further replies.
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.

"Michael Schmitz" <spam@gmx.net> wrote in message

news:Oj46Yp3wJHA.1208@TK2MSFTNGP04.phx.gbl...
> 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;
> }
> }
>
 
" - " <kenslovak@mvps.org> schrieb im Newsbeitrag

news:OHlrqmBxJHA.1212@TK2MSFTNGP04.phx.gbl...
> 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.

"Michael Schmitz" <spam@gmx.net> wrote in message

news:OEa8ZjFxJHA.4956@TK2MSFTNGP02.phx.gbl...

> " - " <kenslovak@mvps.org> schrieb im Newsbeitrag
> news:OHlrqmBxJHA.1212@TK2MSFTNGP04.phx.gbl...
> > 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

>
 
" - " <kenslovak@mvps.org> schrieb im Newsbeitrag

news:udPOLzNxJHA.1236@TK2MSFTNGP02.phx.gbl...
> 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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M VSTO Outlook2007 Addin. After switching from 3.5 to 2.0 Framework i get "'MSB3185: EntryPoint not sp Outlook VBA and Custom Forms 1
N How to add Dear & mail receipts name while reply to that mail in outlook2007 Outlook VBA and Custom Forms 1
B The “run a script” function stopped unexpectedly in Outlook2007 Using Outlook 6
D Outlook2007 Email problem with automation Outlook VBA and Custom Forms 4
Z Outlctl disabled (Outlook2007 SP2) Outlook VBA and Custom Forms 2
R Could i do this with ribbon(outlook2007)? Outlook VBA and Custom Forms 1
R About repurpose ribbonX of outlook2007? Outlook VBA and Custom Forms 3
Y How to record macros in Outlook2007? Outlook VBA and Custom Forms 1
M c# vsto Outlook.ApplicationEvents_11_NewMailEx Outlook VBA and Custom Forms 1
M Develop for OL2003 on OL2007 machine using VS2008 and VSTO? Outlook VBA and Custom Forms 1
A Not able to load an add-in for outlook 2007 developed in VSTO 2005 Outlook VBA and Custom Forms 2
E VSTO 2008 how to bind Form Region controls to Item data fields Outlook VBA and Custom Forms 2
E VSTO 2008 how to bind Form Region controls to Item data fields Outlook VBA and Custom Forms 3
T VSTO Outlook add-in: Categories not displaying correctly Outlook VBA and Custom Forms 3
O VSTO - Outlook Add-In - Get GAL data Outlook VBA and Custom Forms 1
M VSTO deployment? Outlook VBA and Custom Forms 1
K Outlook VSTO Add-in not visible in Trust Center after installing Outlook VBA and Custom Forms 1
M VSTO C#: How do I declare an application scope variable? Outlook VBA and Custom Forms 2
M Will a VSTO C# Outlook 2007 Add-in work on Outlook 2010? Outlook VBA and Custom Forms 1
S VSTO calling unmanged function Outlook VBA and Custom Forms 3
X Highlight block of text in an outlook mail using c#2008 vsto Outlook VBA and Custom Forms 1
W My VSTO 3.0 Outlook addin doesn’t load Outlook VBA and Custom Forms 1
G Interop or VSTO or ? Outlook VBA and Custom Forms 2
M VSTO 2007 Addin auto-disabled on one machine but not another on installation? Outlook VBA and Custom Forms 1
N VSTO outlook 2007 addin installation problem Outlook VBA and Custom Forms 1
O Third-party VSTO 2005 SE plug-in for Outlook 2007: what should I signwith a publisher certificate? Outlook VBA and Custom Forms 3
O Outlook VSTO 2005 plug-in installer: CLSID = ? Outlook VBA and Custom Forms 3
O using VSTO to get Available Mailboxes Outlook VBA and Custom Forms 11
E Opening WinForm in Outlook 2003 VSTO Addin with Wordmail enabled Outlook VBA and Custom Forms 1
C Problem installing VSTO AddIn on Vista Outlook VBA and Custom Forms 3
D a general question re how backup programs handle pst files ... I have no problems, just curious Using Outlook 1
D How to handle filing of emails from an Inbox Subfolder to a specific Public folder Using Outlook 1
B Easy to handle backup tool Using Outlook 1
P Trapping AttachmentAdd in VBA does not handle multiple email instances Using Outlook 1
C Rule to Handle Meeting Replies that updates tracking information Using Outlook 2
M How to handle Outlook Contacts who have multiple Names BCM (Business Contact Manager) 1
T How to get Inspector object from Window handle Outlook VBA and Custom Forms 2
C Why can't 2003 handle the macros I wrote for 2000 Outlook VBA and Custom Forms 6
M How to get active inspector window handle? Outlook VBA and Custom Forms 3
M How to get the preview pane handle, when it is created with menu c Outlook VBA and Custom Forms 1

Similar threads

Back
Top