internal void FixLegacyDNRelatedFlag(MailboxSession mailboxSession)
        {
            bool flag = string.Equals(mailboxSession.MailboxOwner.LegacyDn, this.GetLegacyDNFromStoreEntryId(), StringComparison.OrdinalIgnoreCase);

            if (base.IsFlagSet(NavigationNodeFlags.IsDefaultStore))
            {
                if (!flag)
                {
                    this.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(mailboxSession.MailboxOwner);
                    return;
                }
            }
            else if (flag)
            {
                base.NavigationNodeFlags |= NavigationNodeFlags.IsDefaultStore;
            }
        }
        private void Initialize(MailboxSession session, bool isMyMailbox, StoreObjectId folderId, object recordKey, ExtendedFolderFlags flags, Guid groupClassId, string groupName)
        {
            StoreObjectId storeObjectId = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.Root);

            if (storeObjectId != null && storeObjectId.Equals(folderId))
            {
                throw new NotSupportedException("We don't support adding root folder to favorites.");
            }
            if (!session.IsRemote)
            {
                this.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(session.MailboxOwner);
            }
            this.NavigationNodeEntryId = folderId.ProviderLevelItemId;
            if (recordKey is byte[])
            {
                this.NavigationNodeRecordKey = (byte[])recordKey;
            }
            StoreObjectId storeObjectId2 = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.ToDoSearch);

            if (storeObjectId2 != null && storeObjectId2.Equals(folderId))
            {
                base.NavigationNodeFlags |= NavigationNodeFlags.TodoFolder;
            }
            foreach (KeyValuePair <ExtendedFolderFlags, NavigationNodeFlags> keyValuePair in NavigationNodeFolder.mappingFromFolderFlagToNodeFlag)
            {
                if (Utilities.IsFlagSet((int)flags, (int)keyValuePair.Key))
                {
                    base.NavigationNodeFlags |= keyValuePair.Value;
                }
            }
            if (isMyMailbox)
            {
                base.NavigationNodeFlags |= NavigationNodeFlags.IsDefaultStore;
            }
            if (!base.IsFavorites)
            {
                this.NavigationNodeParentGroupClassId = groupClassId;
                this.NavigationNodeGroupName          = groupName;
            }
        }
        internal static NavigationNodeFolder CreateGSNode(ExchangePrincipal exchangePrincipal, Guid groupClassId, string groupName, string subject, NavigationNodeGroupSection navigationNodeGroupSection)
        {
            NavigationNodeFolder navigationNodeFolder = new NavigationNodeFolder(subject, navigationNodeGroupSection);

            navigationNodeFolder.GSCalendarSharerAddressBookEntryId = AddressBookEntryId.MakeAddressBookEntryID(exchangePrincipal);
            UserContext userContext = OwaContext.Current.UserContext;

            navigationNodeFolder.GSCalendarShareeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(userContext.ExchangePrincipal);
            try
            {
                using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, userContext))
                {
                    try
                    {
                        using (Folder folder = Folder.Bind(owaStoreObjectIdSessionHandle.Session as MailboxSession, DefaultFolderType.Calendar, new PropertyDefinition[]
                        {
                            StoreObjectSchema.EffectiveRights
                        }))
                        {
                            if (CalendarUtilities.UserHasRightToLoad(folder))
                            {
                                navigationNodeFolder.NavigationNodeEntryId      = folder.StoreObjectId.ProviderLevelItemId;
                                navigationNodeFolder.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(exchangePrincipal);
                            }
                        }
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                }
            }
            catch (OwaSharedFromOlderVersionException)
            {
            }
            navigationNodeFolder.ClearDirty();
            return(navigationNodeFolder);
        }