Open another users calendar

  • Thread starter Thread starter Steve Finlayson
  • Start date Start date
S

Steve Finlayson

I would like to create a macro that would open the calendar of another
user. Actually, I am trying to open another window showing my calendar
as another user. I can do this in Outlook XP. I would just like to
automate the process so it is a click away.
If you can help me with the code, I would appreciate it.
Thanks
Steve
 
set Recip = Application.Session.CreateRecipient("user name")
Set Folder = Application.Session.GetSharedDefaultFolder(Recip,
olFolderCalendar)
Folder.Display


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I'd throw a Recip.Resolve in there:

set Recip = Application.Session.CreateRecipient("user name")
If Recip.Resolve Then
Set Folder = Application.Session.GetSharedDefaultFolder _
(Recip, olFolderCalendar)
Folder.Display
End If
 
Calling Resolve() is not necessary. If you do, Resolve() will trigger a
security prompt; GetSharedDefaultFolder() works just fine without it.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


I'd throw a Recip.Resolve in there:

set Recip = Application.Session.CreateRecipient("user name")
If Recip.Resolve Then
Set Folder = Application.Session.GetSharedDefaultFolder _
(Recip, olFolderCalendar)
Folder.Display
End If
 
Good point about the security prompt. But it won't work as is if you have an ambiguous recipient. Better to use "user address" than "user name" perhaps?
 
If it is ambiguous, GetSharedDefaultFolder will fail, if I remember my
experiments correctly ("Outlook does not recognize one or more names"), you
just need to use "on error" handler.
Good point about the e-mail address, it is always unambiguous and preferable
over a display name in most cases.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


Good point about the security prompt. But it won't work as is if you have an
ambiguous recipient. Better to use "user address" than "user name" perhaps?
 
Back
Top