0

I already have a Array of each resource in the distribution list. How do I check each resource in the array is available via exchange server during the start and end time user is requesting? This will be an outlook addin on the ribbon.

 Public Sub AddElementToStringArray(ByVal stringToAdd As String)
    ReDim Preserve distArray(distArrayElements)
    distArray(distArrayElements) = stringToAdd
    distArrayElements += 1
End Sub

Dim startDate As Date
Dim endDate As Date

Sub checkAvailable()

    'distArray declared earlier.
    If distArray Is Nothing Then
        Exit Sub
    Else
        'Check if they are available.
        'if available, add to resourceListBox.
    End If

End Sub
Jason
  • 650
  • 2
  • 10
  • 33
  • 1
    See suggestion here: http://stackoverflow.com/questions/5622477/vba-outlook-seeing-peoples-calendars – Tim Williams Jan 28 '15 at 18:18
  • I don't want to display their calendar on screen, I want this all to happen in the background. I want to take the array I have, which is the resources of a distribution list and check each one in a loop if they're available during the start and end date. if they are then display them in the listbox. – Jason Jan 28 '15 at 20:03
  • Are you hoping to do this via the outlook client, or directly against the server? Maybe you can also add what environment you're working in (Excel? Outlook?) – Tim Williams Jan 28 '15 at 20:26
  • Updated, outlook addin on the ribbon. I am wanting this to happen through outlook, in the background. my addin displays a form that the user selects laptop or projector or both, and start and end dates to check it out. then sends a meeting request to the resource, which is handled by the auto calendar asst. Thank you – Jason Jan 28 '15 at 20:53

1 Answers1

1
Public Sub GetFreeBusyInfo()
   Dim myOlApp As New Outlook.Application
   Dim myNameSpace As Outlook.NameSpace
   Dim myRecipient As Outlook.Recipient
   Dim myFBInfo As String
   Set myNameSpace = myOlApp.GetNamespace("MAPI")
   Set myRecipient = myNameSpace.CreateRecipient("Nate Sun")
   On Error GoTo ErrorHandler
   myFBInfo = myRecipient.FreeBusy(#11/11/2003#, 60 * 24)
   MsgBox myFBInfo
   Exit Sub
ErrorHandler:     
    MsgBox "Cannot access the information. "
End Sub
Jason
  • 650
  • 2
  • 10
  • 33