VBA, Outlook, Seeing 'People's Calendars

前端 未结 3 1515
野趣味
野趣味 2020-12-18 11:37

I am tring to programmatically (with VBA) to access calendars others share with me. They are listed in my Outlook under \'People\'s Calendars.\' I have searched the Web for

3条回答
  •  情话喂你
    2020-12-18 12:24

    Check out the returned values from the following code. It searches for a person by name, same way as when you are typing a recipient into a new email, and then grabs that persons shared calendar and enumerates all shared appointments.

    Dim _namespace As Outlook.NameSpace
    Dim _recipient As Outlook.Recipient
    Dim calendarFolder As Outlook.Folder
    
    Set _namespace = Application.GetNamespace("MAPI")
    Set _recipient = _namespace.CreateRecipient(name)
    _recipient.Resolve
    
    If _recipient.Resolved Then
        Set calendarFolder = _namespace.GetSharedDefaultFolder(_recipient, olFolderCalendar)
        'This would display the calendar on the screen:
        'calendarFolder.Display
    
        Dim oItems As Outlook.Items
        Set oItems = calendarFolder.Items
        'oItems is now a set of all appointments in that person's calendar
        'Play on
    End if
    

提交回复
热议问题