VB6 App Notify on MS Outlook Share Calendar

Hi there,
I have the scenario:
- User1 have a MS Outlok Shared Calendar
- User2 have rights to access the calendar and read/write rights
I want to make an app in VB6 that wil do: when User2 do something in the User1 calendar (e.g.: create an appointment) User1 (calendar owner) will be automaticly notified by email.

Please tell me who can I do this.
Thank you very much!
LVL 1
maonasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi maonas,

Yes, this is possible, but there's an issue you need to be aware of.  Sending email from code will trigger Outlook's built-in security causing a dialog-box to pop up warning that a program is accessing the maibox and asking for permission to continue.  The only way around this is to use a third-party tool.  Also, where do you plan to run this application at?  If it's not on User1 or User2's computer, then the computer it's on will have to have Outlook, be connected to User1's profile, and potentially know User1's password.

Cheers!
0
maonasAuthor Commented:
The app should be on User1's computer under user1's domain accout with MS Outlook.
0
David LeeCommented:
Ok.  I'll get the code posted shortly (within the next 24 hours).
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

David LeeCommented:
maonas,

Here's the code.  I haven't had an opportunity to test it with another user, but it should work.  I'm concerned that it might also notify User1 any time they accept an appointment from another user.  Try it out and let me know.  I changed one thing from your original request.  Instead of sending an email from User1 to User1 notify him/her that an item's been added to the calendar, I added a new post to User1's Inbox.  Follow these instructions to put the code into use.

1.  Start Outlook.
2.  Click Tools->Macros->Visual Basic Editor.
3.  If not already expanded, expand Microsoft Office Outlook Objects and select ThisOutlookSession.
4.  Copy the code and paste it into the right-hand pane of the VB editor.
5.  Click the diskette icon on the toolbar to save the code.
6.  Close the VB editor.
7.  Click Tools->Macros->Security.
8.  Change the security level to Medium.
9.  Click Ok.
10.  Close Outlook.
11.  Start Outlook.
12.  You'll receive a dialog-box telling you that ThisOutlookSession contains macros and asking if you want to enable them.  Click Enable Macros.
13.  Have User2 add an appointment to User1's calendar.


'Macro Begins Here
Private WithEvents olkCalendar As Outlook.Items

Private Sub Application_Startup()
    Set olkCalendar = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Application_Quit()
    Set olkCalendar = Nothing
End Sub

Private Sub olkCalendar_ItemAdd(ByVal Item As Object)
    Dim olkNotification As Outlook.PostItem
    If Item.Organizer <> Session.CurrentUser Then
        Set olkNotification = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.Add(olPostItem)
        olkNotification.Subject = "New Appointment Added to Your Calendar"
        olkNotification.Body = Item.Organizer & " has added a new appointment to your calendar."
        olkNotification.Save
    End If
    Set olkNotification = Nothing
End Sub
'Macro Ends Here
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maonasAuthor Commented:
Thank you BlueDevilFan
The solution it's great
0
David LeeCommented:
Thank you, and you're welcome.
0
maonasAuthor Commented:
I think i have a problem when User2 add an appointment to User1's calendar the item.Organizer from Private Sub olkCalendar_ItemAdd(ByVal Item As Object) is "User1" not "User2".

Please help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.