public void SetCalendarColor() { base.ThrowIfCannotActAsOwner(); int serverColorIndex = CalendarColorManager.GetServerColorIndex((int)base.GetParameter("Idx")); NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, NavigationNodeGroupSection.Calendar); NavigationNodeFolder[] array = null; OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("fId"); if (owaStoreObjectId.IsGSCalendar) { array = navigationNodeCollection.FindGSCalendarsByLegacyDN(owaStoreObjectId.MailboxOwnerLegacyDN); } else { array = navigationNodeCollection.FindFoldersById(owaStoreObjectId.StoreObjectId); } if (array == null || (array.Length == 0 && !owaStoreObjectId.IsGSCalendar)) { using (Folder calendarFolder = this.GetCalendarFolder(false)) { NavigationNodeGroupType groupType = NavigationNodeGroupType.MyFoldersGroup; bool flag = base.UserContext.IsInOtherMailbox(calendarFolder); if (flag || Utilities.IsOneOfTheFolderFlagsSet(calendarFolder, new ExtendedFolderFlags[] { ExtendedFolderFlags.SharedIn, ExtendedFolderFlags.ExchangeCrossOrgShareFolder })) { groupType = NavigationNodeGroupType.SharedFoldersGroup; } array = new NavigationNodeFolder[] { navigationNodeCollection.AddFolderToDefaultGroup(base.UserContext, groupType, calendarFolder, flag) }; } } if (array != null) { foreach (NavigationNodeFolder navigationNodeFolder in array) { navigationNodeFolder.NavigationNodeCalendarColor = serverColorIndex; } navigationNodeCollection.Save(base.UserContext.MailboxSession); } }