A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 22nd 09, 07:44 PM posted to microsoft.public.outlook.program_forms
Michael Schmitz
external usenet poster
 
Posts: 11
Default Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO?

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


Ads
  #2  
Old April 23rd 09, 02:42 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO?

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
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Michael Schmitz" wrote in message
...
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;
}
}


  #3  
Old April 23rd 09, 10:17 PM posted to microsoft.public.outlook.program_forms
Michael Schmitz
external usenet poster
 
Posts: 11
Default Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO?


"Ken Slovak - [MVP - Outlook]" schrieb im Newsbeitrag
...
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


  #4  
Old April 24th 09, 02:01 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO?

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
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Michael Schmitz" wrote in message
...

"Ken Slovak - [MVP - Outlook]" schrieb im Newsbeitrag
...
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



  #5  
Old April 26th 09, 09:13 PM posted to microsoft.public.outlook.program_forms
Michael Schmitz
external usenet poster
 
Posts: 11
Default Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO?


"Ken Slovak - [MVP - Outlook]" schrieb im Newsbeitrag
...
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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VSTO Outlook2007 Addin. After switching from 3.5 to 2.0 Framework i get "'MSB3185: EntryPoint not specified for manifest" Michael Schmitz Add-ins for Outlook 1 April 22nd 09 02:38 PM
VSTO Outlook2007 Addin. After switching from 3.5 to 2.0 Framework i get "'MSB3185: EntryPoint not specified for manifest" Michael Schmitz Outlook - General Queries 2 April 21st 09 08:19 PM
Getting handle of an active dialog window Ewgenij Sokolovski Outlook and VBA 6 December 16th 08 03:35 PM
When I click Signatures in Outlook2007, nothing happens. whitewinter Outlook - Installation 0 June 11th 07 10:10 AM
Howto save Word attachment? Deon Outlook - General Queries 4 February 7th 07 06:00 AM


All times are GMT +1. The time now is 01:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.