access office 365 group folder in outlook vba

Deleted
Not applicable

I am trying to write a macro which would create an appointment in O365 group calendar.
I am able to create the appointment if the current folder is the group calender. However, I want the macro to always create the appointment for the group calendar, irrespective of the current folder. I have looked at other posts on accessing shared calendar and other subfolders under default calendar, but I am not able to find anything that works for a group calender.

I have tried these things:

 ' option1
  Set calFolder = GetFolderPath("abc@email.com\Calendars\groupname")
  Set NameSpace = Application.GetNamespace("MAPI")
  ' option 2
  Set calFolder = NameSpace.GetDefaultFolder(9).Folders("groupname")
  NameSpace.GetSharedDefaultFolder("groupemail", olFolderCalendar)
  Set Items = calFolder.Items
  ' option 3  
  Set Items = Application.Session.GetDefaultFolder(olFolderCalendar).Parent.Folders("groupname").Items

 

In the folder structure it appear like this:

My Mailbox

-Groups

--abc

Appreciate any pointers. Thanks in advance!

I found this structure for the group I am looking for in the debugger:

Namespace
|
AddressLists
|
|
Item 7 : Name: All groups
|
AddressEntries
|
Item 18: Name: abc

Is there a way I can use this information to get the folder?

0 Replies