コード例 #1
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            ExchangePrincipal principal = ExchangePrincipal.FromADUser(base.DataObject, RemotingOptions.AllowCrossSite);

            using (MailboxSession mailboxSession = StoreTasksHelper.OpenMailboxSession(principal, "Remove-PushNotificationSubscription"))
            {
                using (IPushNotificationStorage pushNotificationStorage = PushNotificationStorage.Find(mailboxSession))
                {
                    if (pushNotificationStorage != null)
                    {
                        if (this.SubscriptionStoreId != null)
                        {
                            pushNotificationStorage.DeleteSubscription(this.SubscriptionStoreId.StoreObjectIdValue);
                        }
                        else if (this.Force || base.ShouldContinue(Strings.ConfirmRemoveUserPushNotificationSubscriptions(this.Mailbox.ToString())))
                        {
                            if (base.ParameterSetName.Equals("RemoveStorage"))
                            {
                                PushNotificationStorage.DeleteStorage(mailboxSession);
                            }
                            else
                            {
                                pushNotificationStorage.DeleteAllSubscriptions();
                            }
                        }
                    }
                }
            }
            TaskLogger.LogExit();
        }
コード例 #2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            ADUser            aduser    = (ADUser)base.GetDataObject <ADUser>(this.Mailbox, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.Mailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.Mailbox.ToString())));
            ExchangePrincipal principal = ExchangePrincipal.FromADUser(aduser, RemotingOptions.AllowCrossSite);

            using (MailboxSession mailboxSession = StoreTasksHelper.OpenMailboxSession(principal, "Get-PushNotificationSubscription"))
            {
                StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.PushNotificationRoot);
                if (defaultFolderId != null)
                {
                    using (IFolder folder = GetPushNotificationSubscription.xsoFactory.BindToFolder(mailboxSession, defaultFolderId))
                    {
                        IEnumerable <IStorePropertyBag> enumerable;
                        if (this.ShowAll)
                        {
                            enumerable = new SubscriptionItemEnumerator(folder, this.ResultSize);
                        }
                        else
                        {
                            enumerable = new ActiveSubscriptionItemEnumerator(folder, this.ExpirationTimeInHours, this.ResultSize);
                        }
                        foreach (IStorePropertyBag propertyBag in enumerable)
                        {
                            this.WriteResult(this.CreatePresentationObject(propertyBag, aduser, mailboxSession));
                        }
                    }
                }
            }
            TaskLogger.LogExit();
        }