PDA

Click to See Complete Forum and Search --> : VB - Outlook question: How can I check if someone is in a meeting ?


yarivp
Feb 14th, 2006, 07:20 AM
How can I tell if someone who uses outlook in lan is currently in a meeting ?
Thanks !

si_the_geek
Feb 14th, 2006, 07:40 AM
Moved to Office Development

RobDog888
Feb 14th, 2006, 09:25 AM
You can either do a .Restrict or a .Find for the person on the Calendar in question checking the date range.

yarivp
Feb 15th, 2006, 02:31 AM
Thanks RobDog,
But I don't know the vb - outlook interface that well,
can you add a small piece of code to explain ?

RobDog888
Feb 19th, 2006, 12:58 AM
This should give you all the mechanics to do what you need.
Option Explicit
'Code written by RobDog888
'Add a reference to MS Outlook xx.0 Object Library
Private Sub Command1_Click()

Dim oApp As Outlook.Application
Dim oAppts As Outlook.Items
Dim oAppt As Object 'Late bind as Object in case there are other types of calendar items (Appt or Meeting)
Dim sToday As String

Set oApp = New Outlook.Application
Set oAppts = oApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
oAppts.Sort "[Start]"
oAppts.IncludeRecurrences = True
'Restrict the collection to just today
sToday = "([Start] >= '" & Date & " 12:00 AM' AND [Start] < '" & DateAdd("d", 1, Date) & " 12:00 AM')"
sToday = sToday & " AND"
sToday = sToday & " ([Subject] = 'Crucial Meeting')"
Set oAppts = oAppts.Restrict(sToday)
oAppts.Sort "[Start]"
Set oAppt = olAppts.GetFirst
Do While TypeName(oAppt) <> "Nothing"
'Display all the appointments during this day and with the subject 'Crucial Meeting'
MsgBox oAppt.Subject & vbNewLine & oAppt.Start & " - " & oAppt.End, vbOKOnly, "Meeting Date/Time"
Set oAppt = oAppts.GetNext
Loop
Set oAppt = Nothing
Set oAppts = Nothing
oApp.Quit
Set oApp = Nothing

End Sub

yarivp
Feb 19th, 2006, 08:33 AM
Thanks RobDog888, That's looks great !! :wave:

yarivp
Feb 19th, 2006, 08:41 AM
One last thing...
This code return my schedule. How can I tell if someone else is busy right now ?

RobDog888
Feb 19th, 2006, 12:25 PM
You will need to open the Calendar where that info is like a Public Calendar or a Shared Calendar.