Esempio n. 1
0
        private static bool ScrubElcMailbox(bool userIsOnRetentionPolcyTags, MailboxSession mailboxSession, Dictionary <Guid, AdTagData> allAdTags, out UpgradeStatus status)
        {
            status = UpgradeStatus.None;
            bool          result          = true;
            StoreObjectId elcRootFolderId = ElcMailboxHelper.GetElcRootFolderId(mailboxSession);

            if (elcRootFolderId != null)
            {
                result = ElcMailboxHelper.RemoveElcFolder(userIsOnRetentionPolcyTags, mailboxSession, elcRootFolderId, allAdTags, out status);
            }
            object[] array = null;
            using (Folder folder = Folder.Bind(mailboxSession, DefaultFolderType.Root, ProvisionedFolderReader.ElcFolderProps))
            {
                array = folder.GetProperties(ProvisionedFolderReader.ElcFolderProps);
                using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.None, null, null, ProvisionedFolderReader.ElcFolderProps))
                {
                    for (;;)
                    {
                        object[][] rows = queryResult.GetRows(100);
                        if (rows.Length <= 0)
                        {
                            break;
                        }
                        foreach (object[] array2 in rows)
                        {
                            if (ElcMailboxHelper.IsElcFolder(array2))
                            {
                                ElcMailboxHelper.UpgradeElcFolder(userIsOnRetentionPolcyTags, mailboxSession, (VersionedId)array2[0], allAdTags);
                            }
                        }
                    }
                }
            }
            if (ElcMailboxHelper.IsElcFolder(array))
            {
                ElcMailboxHelper.UpgradeElcFolder(userIsOnRetentionPolcyTags, mailboxSession, (VersionedId)array[0], null);
            }
            StoreId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox);

            mailboxSession.UserConfigurationManager.DeleteFolderConfigurations(defaultFolderId, new string[]
            {
                "ELC"
            });
            return(result);
        }