Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Read other Outlook Appointments

Status
Not open for further replies.

JoseC

Programmer
Dec 11, 2001
18
0
0
Using the following code I found, I can read my "own" appointments for given date.
But how do I read other peoples appointments??
Application will be used by a front desk receptionist and she'll enter a name and the VB app will respond with the individual's schedule for that day.

'**********************
Sub ShowDaysAppointments()
Dim myOlApp As New Outlook.Application
Dim myAppt As AppointmentItem
Dim myNS As NameSpace
Dim myAppts As Items
Dim strTheDay As String
Dim strToday As String
Dim strMsg As String

' Get the day from the user. User can enter
' date in nearly any format.
strTheDay = _
InputBox("Enter the day for which you want " _
& "to see appointments")
' Specify the range.
strToday = "[Start] >= '" & strTheDay & _
&quot;' and [Start] < '&quot; & strTheDay & &quot; 11:59 pm'&quot;
' Get user's appointments from Calendar folder.
Set myNS = myOlApp.GetNamespace(&quot;MAPI&quot;)
Set myAppts = myNS.GetDefaultFolder(olFolderCalendar).Items
'Sort the collection (required by IncludeRecurrences).
myAppts.Sort &quot;[Start]&quot;
'Make sure recurring appointments are included.
myAppts.IncludeRecurrences = True
'Filter the collection to include only the day's appointments.
Set myAppts = myAppts.Restrict(strToday)
'Sort it again to put recurring appointments in correct order.
myAppts.Sort &quot;[Start]&quot;
'Loop through collection and get subject and
'start time of each item.
Set myAppt = myAppts.GetFirst
Do While TypeName(myAppt) <> &quot;Nothing&quot;
strMsg = strMsg & vbLf & myAppt.Subject
strMsg = strMsg & &quot; at &quot; & Format(myAppt.Start, &quot;h:mm ampm&quot;)
strMsg = strMsg & &quot; till &quot; & Format(myAppt.End, &quot;h:mm ampm&quot;) 'JC added.
Set myAppt = myAppts.GetNext
Loop
' Display the information.
MsgBox &quot;Your appointments for &quot; & strTheDay & &quot; are &quot; _
& vbLf & strMsg

Set myOlApp = Nothing
Set myAppt = Nothing
Set myNS = Nothing
Set myAppts = Nothing
End Sub
'**********************


Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top