Microsoft KB Archive/177216

= How To Open Another User's Schedule Programmatically =

Article ID: 177216

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Schedule+ 97 Standard Edition

-



This article was previously published under Q177216



SUMMARY
There 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 INFORMATION
The steps outlined below are required to open the schedule of another user:


 * 1) Create a Schedule+ object and log in.
 * 2) Create a MAPI Session object and log in.
 * 3) Setup a recipient object for the user whose schedule is going to be opened.
 * 4) Create a valid entry id for the ScheduleForUser call by issuing a resolve.
 * 5) Open user's schedule using the ScheduleForUser.
 * 6) Log off of MAPI and Schedule+ and release the objects.

The following code comes from the click event of a CommandButton called Command1 and demonstrates how to open another user's schedule: 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")

' Specify a valid profile name for "My Profile" objApp.Logon profilename:="My Profile"

'Create a MAPI Session

Set objSession = CreateObject("MAPI.Session") objSession.Logon profilename:="My Profile"

'Setup Recipient Object for the user whose schedule 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

