// Token: 0x06000E85 RID: 3717 RVA: 0x000372CC File Offset: 0x000354CC
        public string SubscribeToUnseenItemNotification(string subscriptionId, UserMailboxLocator mailboxLocator, IRecipientSession adSession)
        {
            lock (this.syncRoot)
            {
                if (this.isDisposed)
                {
                    throw new OwaInvalidOperationException("[OwaMapiNotificationManager::SubscribeToUnseenItemNotification] Subscribe failed because object OwaMapiNotificationManager is disposed.");
                }
                if (this.unseenItemHandler == null)
                {
                    this.unseenItemHandler = new UnseenItemNotificationHandler(this.userContext, adSession);
                    this.unseenItemHandler.Subscribe();
                    this.notificationHandlers.Add(this.unseenItemHandler);
                    this.WireConnectionDroppedHandler(this.unseenItemHandler);
                }
            }
            string result;

            try
            {
                this.userContext.LockAndReconnectMailboxSession(3000);
                result = this.unseenItemHandler.AddMemberSubscription(subscriptionId, mailboxLocator);
            }
            finally
            {
                if (this.userContext.MailboxSessionLockedByCurrentThread())
                {
                    this.userContext.UnlockAndDisconnectMailboxSession();
                }
            }
            return(result);
        }
Esempio n. 2
0
        // Token: 0x06000CAF RID: 3247 RVA: 0x0002EC70 File Offset: 0x0002CE70
        public string SubscribeToUnseenItemNotification(string subscriptionId, UserMailboxLocator mailboxLocator, IRecipientSession adSession)
        {
            string result;

            lock (this.syncRoot)
            {
                if (this.isDisposed)
                {
                    result = null;
                }
                else
                {
                    result = this.mapiNotificationManager.SubscribeToUnseenItemNotification(subscriptionId, mailboxLocator, adSession);
                }
            }
            return(result);
        }
        internal string AddMemberSubscription(string subscriptionId, UserMailboxLocator mailboxLocator)
        {
            if (this.groupNotificationLocator == null)
            {
                throw new InvalidOperationException("Cannot add member subscription before subscribing to store notifications");
            }
            string subscriptionId2 = ModernGroupNotificationLocator.GetSubscriptionId(mailboxLocator);

            lock (this.syncNotifierCache)
            {
                if (!this.notifierCache.ContainsKey(subscriptionId2))
                {
                    UnseenItemNotifier unseenItemNotifier = new UnseenItemNotifier(subscriptionId, base.UserContext, subscriptionId2, mailboxLocator);
                    unseenItemNotifier.RegisterWithPendingRequestNotifier();
                    this.notifierCache.Add(subscriptionId2, unseenItemNotifier);
                }
            }
            return(subscriptionId2);
        }
        public static UpdateGroupMailboxBase CreateUpdateGroupMailbox(IRecipientSession adSession, ADUser group, DatabaseLocationInfo databaseLocationInfo, ADUser executingUser, GroupMailboxConfigurationActionType forceActionMask, ADUser[] addedMembers, ADUser[] removedMembers, int?permissionsVersion)
        {
            ExchangePrincipal exchangePrincipal;

            using (new StopwatchPerformanceTracker("UpdateGroupMailboxFactory.CreateUpdateGroupMailbox.BuildExchangePrincipal", GenericCmdletInfoDataLogger.Instance))
            {
                exchangePrincipal = ExchangePrincipal.FromADUser(group, databaseLocationInfo, RemotingOptions.AllowCrossSite);
            }
            Uri backEndWebServicesUrl;

            using (new StopwatchPerformanceTracker("UpdateGroupMailboxFactory.CreateUpdateGroupMailbox.GetBackEndHttpService", GenericCmdletInfoDataLogger.Instance))
            {
                backEndWebServicesUrl = BackEndLocator.GetBackEndWebServicesUrl(exchangePrincipal.MailboxInfo);
                UpdateGroupMailboxFactory.Tracer.TraceDebug(0L, "UpdateGroupMailboxFactory.CreateUpdateGroupMailbox - BackendUrl=" + backEndWebServicesUrl);
            }
            if (ExEnvironment.IsTest && !VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled)
            {
                UserMailboxLocator[] array;
                if (addedMembers == null)
                {
                    array = null;
                }
                else
                {
                    array = (from user in addedMembers
                             select UserMailboxLocator.Instantiate(adSession, user)).ToArray <UserMailboxLocator>();
                }
                UserMailboxLocator[] addedMembers2 = array;
                UserMailboxLocator[] array2;
                if (removedMembers == null)
                {
                    array2 = null;
                }
                else
                {
                    array2 = (from user in removedMembers
                              select UserMailboxLocator.Instantiate(adSession, user)).ToArray <UserMailboxLocator>();
                }
                UserMailboxLocator[] removedMembers2 = array2;
                return(new UpdateGroupMailboxViaXSO(adSession, group, exchangePrincipal, executingUser, forceActionMask, addedMembers2, removedMembers2, permissionsVersion));
            }
            return(new UpdateGroupMailboxViaEWS(group, executingUser, backEndWebServicesUrl, forceActionMask, addedMembers, removedMembers, permissionsVersion));
        }
        protected override void InternalCreateASubscription(IMailboxContext userContext, SubscriptionData subscription, bool remoteSubscription)
        {
            if (subscription.Parameters.FolderId != null)
            {
                throw new ArgumentException("Subscription parameter FolderId cannot be specified on Group subscriptions");
            }
            if (subscription.Parameters.NotificationType != NotificationType.UnseenItemNotification)
            {
                throw new OwaInvalidOperationException("Invalid Notification type specified when calling SubscribeToGroupUnseenNotification");
            }
            if (!(userContext is SharedContext))
            {
                throw new OwaInvalidOperationException("Unseen Notifications should be using a SharedContext");
            }
            this.metricType = SubscribeToNotificationMetadata.UnseenItemNotificationLatency;
            IRecipientSession  adrecipientSession = base.CallContext.ADRecipientSessionContext.GetADRecipientSession();
            UserMailboxLocator mailboxLocator     = UserMailboxLocator.Instantiate(adrecipientSession, base.CallContext.AccessingADUser);
            string             subscriptionId     = userContext.NotificationManager.SubscribeToUnseenItemNotification(subscription.SubscriptionId, mailboxLocator, adrecipientSession);

            subscription.SubscriptionId = subscriptionId;
        }
        // Token: 0x06001535 RID: 5429 RVA: 0x000792F8 File Offset: 0x000774F8
        private void ReplicateOutOfSyncAssociations(MailboxSession mailboxSession, ADUser masterAdUser, IRecipientSession adSession, GroupMailboxAccessLayer accessLayer)
        {
            mailboxSession.Mailbox.GetValueOrDefault <MailboxAssociationProcessingFlags>(MailboxSchema.MailboxAssociationProcessingFlags, MailboxAssociationProcessingFlags.None);
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for GroupMailbox via MailboxAssistant WorkCycle");
                GroupMailboxLocator masterLocator = GroupMailboxLocator.Instantiate(adSession, masterAdUser);
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator);
                return;
            }
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.UserMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for UserMailbox via MailboxAssistant WorkCycle");
                UserMailboxLocator masterLocator2 = UserMailboxLocator.Instantiate(adSession, masterAdUser);
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator2);
                return;
            }
            string message = string.Format("Replication of Mailbox Associations is not yet supported for mailbox of type {0}", masterAdUser.RecipientTypeDetails);

            MailboxAssociationReplicationAssistant.Tracer.TraceError((long)this.GetHashCode(), message);
            throw new NotImplementedException(message);
        }
        // Token: 0x06001536 RID: 5430 RVA: 0x000793B0 File Offset: 0x000775B0
        private void ReplicateAssociations(ADUser masterAdUser, IRecipientSession adSession, ICollection <IMailboxLocator> itemsToReplicate, GroupMailboxAccessLayer accessLayer)
        {
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for GroupMailbox via MailboxAssistant.RunNow");
                GroupMailboxLocator  masterLocator = GroupMailboxLocator.Instantiate(adSession, masterAdUser);
                UserMailboxLocator[] slaveLocators = itemsToReplicate.Cast <UserMailboxLocator>().ToArray <UserMailboxLocator>();
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator, slaveLocators);
                return;
            }
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.UserMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for UserMailbox via MailboxAssistant.RunNow");
                UserMailboxLocator    masterLocator2 = UserMailboxLocator.Instantiate(adSession, masterAdUser);
                GroupMailboxLocator[] slaveLocators2 = itemsToReplicate.Cast <GroupMailboxLocator>().ToArray <GroupMailboxLocator>();
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator2, slaveLocators2);
                return;
            }
            string message = string.Format("Replication of Mailbox Associations is not yet supported for mailbox of type {0}", masterAdUser.RecipientTypeDetails);

            MailboxAssociationReplicationAssistant.Tracer.TraceError((long)this.GetHashCode(), message);
            throw new NotImplementedException(message);
        }
 // Token: 0x06000FDE RID: 4062 RVA: 0x0003D482 File Offset: 0x0003B682
 internal UnseenItemNotifier(string subscriptionId, IMailboxContext userContext, string storeSubscriptionId, UserMailboxLocator userMailboxLocator) : base(userContext)
 {
     this.userMailboxLocator    = userMailboxLocator;
     this.payloadSubscriptionId = subscriptionId;
     base.SubscriptionId        = storeSubscriptionId;
 }
Esempio n. 9
0
 public override MailboxLocator CreateMasterLocator()
 {
     return(UserMailboxLocator.Instantiate(base.AdSession, base.CurrentMailbox));
 }