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
This is office 365 group. Lets call it abc. The group email is abc@somedoamin.com
In the folder structure it appear like this:
My Mailbox
-Groups
--abc
Appreciate any pointers. Thanks in advance!
EDIT: 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?