HOWTO: Open Another User's Schedule ProgrammaticallyLast reviewed: December 18, 1997Article ID: Q177216 |
The information in this article applies to:
SUMMARYThere are times when it may be necessary to open the schedule of another user. You may need to look at existing appointments or add new appointments to the schedule. To accomplish this, you need to use the ScheduleForUser Method of the Application object.
MORE INFORMATIONThe steps outlined below are required to open the schedule of another user:
Private Sub Command1_Click()
Dim objApp As Object
Dim objSched As Object
Dim objOneRecip As Object
Dim objSession As Object
Dim objMessage As Object
'Create a Schedule+ Object
Set objApp = CreateObject("SchedulePlus.Application")
objApp.Logon profilename:="cathg (catesp200)"
'Create a MAPI Session
Set objSession = CreateObject("MAPI.Session")
objSession.Logon profilename:="cathg (catesp200)"
'Setup Recipient Object for the user whose Sschedule you
'want to open
Set objMessage = objSession.OutBox.Messages.Add
Set objOneRecip = objMessage.Recipients.Add
objOneRecip.Name = "Bugs Bunny"
objOneRecip.Type = 1
'Create a valid EntryId for the ScheduleForUser call
objOneRecip.Resolve
'Open User's Schedule
Set objSched = _
objApp.ScheduleForUser(objOneRecip.AddressEntry.Type _
+ ":" + objOneRecip.AddressEntry.Address, _
objOneRecip.AddressEntry.Name, 1, 3, _
objOneRecip.AddressEntry.ID)
'Print information for user to show you are attached to
'another schedule
Debug.Print objSched.UserName
MsgBox (objSched.UserAddress)
'Log off of Mail and Schedule+ and release the objects
objSession.Logoff
objApp.Logoff
Set objOneRecip = Nothing
Set objMessage = Nothing
Set objSched = Nothing
Set objSession = Nothing
End Sub
NOTE: This code only works correctly if the calendar is group enabled.
For more information on how to group enable Schedule+, please see the
following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q141066 TITLE : WSPlus: How to Force Schedule+ 7.0 to Ask to Work in Group Keywords : kbprg GnrlVB vbwin Technology : kbvba Version : WINDOWS:5.0,7.0 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |