[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Outlook-add-in: How do I catch when a new appointment has been saved?

M O J O

10/25/2007 11:17:00 AM

Hi,

From an vb.net-outlook-add-in ... how do I catch an event telling when
an appointment has been saved?

Thanks!!

M O J O
2 Answers

jialge

10/26/2007 4:44:00 AM

0

Hello M O J O,

From your post, my understanding on this issue is: you want to know how to
capture the Save event of an Outlook.AppointmentItem object. If I'm off
base, please feel free to let me know.

To capture the Save event of an Outlook.AppointmentItem object, we need to
register the Outlook.Appointment.Write event. According to the MSDN article
http://msdn2.microsoft.com/en-us/librar...(office.11).aspx and
http://msdn2.microsoft.com/en-us/library/bb1...
The Write event occurs when an appointment is saved, either explicitly (for
example, using the Save or SaveAs method) or implicitly (for example, in
response to a prompt when closing the item's inspector).

Below is my test code of the event with VB.NET:

Imports Outlook = Microsoft.Office.Interop.Outlook

Public Class Form1

Public WithEvents appointment As Outlook.AppointmentItem

Private Sub appointment_Write(ByRef Cancel As Boolean) Handles
appointment.Write
MessageBox.Show("write")
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim appItem As Outlook.Application = New Outlook.Application()
appointment =
appItem.CreateItem(Outlook.OlItemType.olAppointmentItem)
appointment.Subject = "test"
appointment.Body = "test"
appointment.Save()
End Sub
End Class

The appointment object registers the Write event and show a message box
"write" when the appointment is saved (appointment.Save())

Please have a try and let me know the result. If you have any other concern
or need anything else, please feel free to let me know.

Sincerely,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/posting...

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/de....
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

M O J O

10/26/2007 5:28:00 AM

0

Hi Jialiang,

Once again you come to my rescue ... and THANKS!!!!

Here's my solution....

Private Sub OnNewInspector(ByVal inspector As Outlook.Inspector)
If TypeOf (inspector.CurrentItem) Is Outlook.AppointmentItem Then
AddHandler CType(inspector.CurrentItem,
Outlook.AppointmentItem).write, AddressOf _appItem_Write
End If
End Sub

Private Sub appointmentItem_Write(ByRef Cancel As Boolean)
Dim app As Outlook.AppointmentItem =
CType(Application.ActiveInspector.CurrentItem, Outlook.AppointmentItem)
' Do something with app!
MsgBox("YEHA")
End Sub


THANKS!!!!

:o))

M O J O

Jialiang Ge [MSFT] skrev:
> Hello M O J O,
>
> From your post, my understanding on this issue is: you want to know how to
> capture the Save event of an Outlook.AppointmentItem object. If I'm off
> base, please feel free to let me know.
>
> To capture the Save event of an Outlook.AppointmentItem object, we need to
> register the Outlook.Appointment.Write event. According to the MSDN article
> http://msdn2.microsoft.com/en-us/librar...(office.11).aspx and
> http://msdn2.microsoft.com/en-us/library/bb1...
> The Write event occurs when an appointment is saved, either explicitly (for
> example, using the Save or SaveAs method) or implicitly (for example, in
> response to a prompt when closing the item's inspector).
>
> Below is my test code of the event with VB.NET:
>
> Imports Outlook = Microsoft.Office.Interop.Outlook
>
> Public Class Form1
>
> Public WithEvents appointment As Outlook.AppointmentItem
>
> Private Sub appointment_Write(ByRef Cancel As Boolean) Handles
> appointment.Write
> MessageBox.Show("write")
> End Sub
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Dim appItem As Outlook.Application = New Outlook.Application()
> appointment =
> appItem.CreateItem(Outlook.OlItemType.olAppointmentItem)
> appointment.Subject = "test"
> appointment.Body = "test"
> appointment.Save()
> End Sub
> End Class
>
> The appointment object registers the Write event and show a message box
> "write" when the appointment is saved (appointment.Save())
>
> Please have a try and let me know the result. If you have any other concern
> or need anything else, please feel free to let me know.
>
> Sincerely,
> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> For MSDN subscribers whose posts are left unanswered, please check this
> document: http://blogs.msdn.com/msdnts/pages/posting...
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
> ications. If you are using Outlook Express/Windows Mail, please make sure
> you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
> see your reply promptly.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/de....
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>