public StoreSession GetSessionForFolderContent(UserContext userContext)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(this, userContext);
            StoreSession result;

            try
            {
                StoreSession sessionForFolderContent = owaStoreObjectIdSessionHandle.SessionForFolderContent;
                userContext.AddSessionHandle(owaStoreObjectIdSessionHandle);
                result = sessionForFolderContent;
            }
            catch (Exception)
            {
                owaStoreObjectIdSessionHandle.Dispose();
                throw;
            }
            return(result);
        }
        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);
        }
        // Token: 0x06000FAC RID: 4012 RVA: 0x00061E9C File Offset: 0x0006009C
        public void SubscribeForFolderCounts(OwaStoreObjectId delegateFolderId, MailboxSession sessionIn)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            MailboxSession mailboxSession = this.userContext.MailboxSession;

            if (sessionIn == mailboxSession)
            {
                if (this.omnhLoggedUser == null)
                {
                    this.omnhLoggedUser = new OwaMapiNotificationHandler(this.userContext, mailboxSession, null);
                    this.WireConnectionDroppedHandler(this.omnhLoggedUser);
                }
                this.omnhLoggedUser.SubscribeForFolderCounts();
                return;
            }
            if (Utilities.IsArchiveMailbox(sessionIn))
            {
                if (this.omnhArchives == null)
                {
                    this.omnhArchives = new List <OwaMapiNotificationHandler>();
                }
                OwaMapiNotificationHandler owaMapiNotificationHandler = null;
                foreach (OwaMapiNotificationHandler owaMapiNotificationHandler2 in this.omnhArchives)
                {
                    if (owaMapiNotificationHandler2.ArchiveMailboxSession == sessionIn)
                    {
                        owaMapiNotificationHandler = owaMapiNotificationHandler2;
                        break;
                    }
                }
                if (owaMapiNotificationHandler == null)
                {
                    owaMapiNotificationHandler = new OwaMapiNotificationHandler(this.userContext, sessionIn, null);
                    this.WireConnectionDroppedHandler(owaMapiNotificationHandler);
                    this.omnhArchives.Add(owaMapiNotificationHandler);
                }
                owaMapiNotificationHandler.SubscribeForFolderCounts();
                return;
            }
            if (this.omnhDelegates == null)
            {
                this.omnhDelegates = new List <OwaMapiNotificationHandler>();
            }
            OwaMapiNotificationHandler owaMapiNotificationHandler3 = null;

            foreach (OwaMapiNotificationHandler owaMapiNotificationHandler4 in this.omnhDelegates)
            {
                if (owaMapiNotificationHandler4.DelegateSessionHandle.Session == sessionIn)
                {
                    owaMapiNotificationHandler3 = owaMapiNotificationHandler4;
                    break;
                }
            }
            if (owaMapiNotificationHandler3 == null)
            {
                OwaStoreObjectIdSessionHandle delegateSessionHandle = new OwaStoreObjectIdSessionHandle(delegateFolderId, this.userContext);
                owaMapiNotificationHandler3 = new OwaMapiNotificationHandler(this.userContext, sessionIn, delegateSessionHandle);
                this.WireConnectionDroppedHandler(owaMapiNotificationHandler3);
                this.omnhDelegates.Add(owaMapiNotificationHandler3);
                this.ReleaseOldestSessionIfNecessary();
            }
            owaMapiNotificationHandler3.SubscribeForFolderCounts();
            owaMapiNotificationHandler3.AddFolderCountsNotification(delegateFolderId);
        }
Beispiel #4
0
        internal OwaMapiNotificationHandler(UserContext userContext, MailboxSession mailboxSession, OwaStoreObjectIdSessionHandle delegateSessionHandle)
        {
            this.mailboxSession        = mailboxSession;
            this.userContext           = userContext;
            this.delegateSessionHandle = delegateSessionHandle;
            this.owaStoreObjectIdType  = OwaStoreObjectId.GetOwaStoreObjectIdType(userContext, mailboxSession, out this.mailboxOwnerLegacyDN);
            StoreObjectId remindersSearchFolderId = this.userContext.RemindersSearchFolderId;

            this.emailPayload = new EmailPayload(userContext, mailboxSession, this);
            this.emailPayload.RegisterWithPendingRequestNotifier();
            this.searchPayload = new SearchPayload(userContext, mailboxSession, this);
            this.searchPayload.RegisterWithPendingRequestNotifier();
        }