I'm trying to add the same calendarGroup to two users via a console app. I have the azure app registration to back it up with the nesceseriy delegated permissions approved by my admin.
I can add new calendarGroups to any user I want but I can't add the same calendarGroup to two or more users, my code would just create a duplicate calendarGroup with a different ID.
It doesn't want to work even when I specifically create and set an Object from an existing calendarGroup and try to add that to my 2nd user it still creates a brand new duplicate one with new ID.
GraphServiceClient graphServiceClient = GetAuthenticatedGraphClient(app, scopes);
//The unique User IDs
var UserWithExistingCalendarGroupIWantToReUse = "MicrosoftId";
var UserWhoIWantToAddCalendarGroupTo= "MicrosoftId2";
//set the current user who we are writing to
var currentUser = UserWhoIWantToAddCalendarGroupTo;
//Get the current user's calendargroups
var currentUsersCalendarGroups = await graphServiceClient.Users[currentUser].CalendarGroups.Request().GetAsync();
//Create an object with already existing CalendarGroup, in this case a group from UserWithExistingCalendarGroupIWantToReUse's diary I created previously
var existingCalendarGroupToAddTo2ndUser = await graphServiceClient.Users[UserWithExistingCalendarGroupIWantToReUse].CalendarGroups["existingCalendarGroupIdIknowAheadOfTime"].Request().GetAsync();
var ok = await graphServiceClient.Users[currentUser].CalendarGroups.Request().AddAsync(existingCalendarGroupToAddTo2ndUser);
It also doesn't seem to be possible to get to all the calendarGroups and potentially try to add users to the groups
graphServiceClient doesn't seem to have endpoints to .Calendar or .CalendarGroup or anything of that sort.
Is it possible to create a new one or fetch an existing calendarGroup, and add it to one or more users now or in the future and have all of them share the same calendarGroup ?