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

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;

}

}
 
K

Ken Slovak - [MVP - Outlook]

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;
> }
> }
>
 
M

Michael Schmitz

" - " <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
 
K

Ken Slovak - [MVP - Outlook]

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

>
 
M

Michael Schmitz

" - " <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.
Thread starter Similar threads 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
P How to get a background immage on Outlook2007 messages Using Outlook 1
W sharing contacts and sharing activity in outlook2007 Using Outlook 1
M since setting up office outlook2007 all messages are being sent to deleted folder in webmail Using Outlook 1
C How to set up to phone so I can dial contacts with MS Outlook2007? Using Outlook 1
R Outlook2007 takes long time to reply in html (internationl) format Using Outlook 2
X My Storage Folder (Filing Cabinet?) Files disappeared when I reloaded Outlook2007 Using Outlook 2
K how to find out what blocking Outlook2007 in non_office network(rpc over http)? Using Outlook 5
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
T Way to avoid annoying typecasts? VSTO V3 Using Outlook 3
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 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
F Create a second Outlook profile to handle a second email account. Using Outlook 2
B Problems with Default to text and need to change to HTML. Must change Font each time I handle mail or typing. Using Outlook 1
S Error 'outlook cannot launch an application to handle d:\xxxxxx' when try to insert file. Using Outlook 1
R Sent Items says the handle is invalid and the Calendar is unable to display the folder Using Outlook 1
A How best to handle shared email folder where history needs to be maintained 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
Similar threads


















































Top