Ejemplo n.º 1
0
        private MailboxFolder RedactMailboxFolder(MailboxFolder folder)
        {
            folder.Name = SuppressingPiiData.Redact(folder.Name);
            string text;
            string text2;

            folder.FolderPath     = SuppressingPiiData.Redact(folder.FolderPath, out text, out text2);
            folder.MailboxOwnerId = SuppressingPiiData.Redact(folder.MailboxOwnerId, out text, out text2);
            return(folder);
        }
Ejemplo n.º 2
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     try
     {
         this.sourceMailboxUser = (ADUser)base.GetDataObject <ADUser>(this.SourceMailbox, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.SourceMailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.SourceMailbox.ToString())), ExchangeErrorCategory.Client);
         this.targetMailboxUser = (ADUser)base.GetDataObject <ADUser>(this.TargetMailbox, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.TargetMailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.TargetMailbox.ToString())), ExchangeErrorCategory.Client);
         if (!object.Equals(this.sourceMailboxUser.OrganizationId, this.targetMailboxUser.OrganizationId))
         {
             base.WriteError(new UsersNotInSameOrganizationPermanentException(this.sourceMailboxUser.ToString(), this.targetMailboxUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox);
         }
         base.RescopeToOrgId(this.sourceMailboxUser.OrganizationId);
         using (MailboxFolderDataProvider mailboxFolderDataProvider = new MailboxFolderDataProvider(base.OrgWideSessionSettings, this.sourceMailboxUser, "New-FolderMoveRequest"))
         {
             foreach (MailboxFolderIdParameter mailboxFolderIdParameter in this.Folders)
             {
                 mailboxFolderIdParameter.InternalMailboxFolderId = new Microsoft.Exchange.Data.Storage.Management.MailboxFolderId(this.sourceMailboxUser.Id, mailboxFolderIdParameter.RawFolderStoreId, mailboxFolderIdParameter.RawFolderPath);
                 MailboxFolder mailboxFolder = (MailboxFolder)base.GetDataObject <MailboxFolder>(mailboxFolderIdParameter, mailboxFolderDataProvider, null, new LocalizedString?(Strings.ErrorMailboxFolderNotFound(mailboxFolderIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxFolderNotUnique(mailboxFolderIdParameter.ToString())));
                 string        entryId       = string.Empty;
                 if (mailboxFolder.InternalFolderIdentity != null && mailboxFolder.InternalFolderIdentity.ObjectId != null)
                 {
                     entryId = mailboxFolder.InternalFolderIdentity.ObjectId.ToHexEntryId();
                 }
                 this.folderList.Add(new MoveFolderInfo(entryId, false));
             }
         }
         if (!string.IsNullOrEmpty(base.Name))
         {
             base.ValidateName();
             base.RequestName = base.Name;
         }
         else
         {
             base.RequestName = "FolderMove";
         }
         ADObjectId mdbId         = null;
         ADObjectId mdbServerSite = null;
         base.Flags = (RequestFlags.IntraOrg | this.LocateAndChooseMdb(this.sourceMailboxUser.Database, this.targetMailboxUser.Database, this.sourceMailboxUser, this.targetMailboxUser, this.targetMailboxUser, out mdbId, out mdbServerSite));
         if (base.WorkloadType == RequestWorkloadType.None)
         {
             base.WorkloadType = RequestWorkloadType.Local;
         }
         base.MdbId         = mdbId;
         base.MdbServerSite = mdbServerSite;
         base.WriteVerbose(Strings.RequestQueueIdentified(base.MdbId.Name));
         this.CheckRequestNameAvailability(base.RequestName, null, false, MRSRequestType.FolderMove, this.TargetMailbox, false);
         base.WriteVerbose(Strings.FolderMoveRequestCheckComplete);
         base.InternalValidate();
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
Ejemplo n.º 3
0
 public static MailboxFolder Redact(MailboxFolder folder, out string raw, out string redacted)
 {
     raw      = null;
     redacted = null;
     if (folder != null)
     {
         folder.Name           = SuppressingPiiData.Redact(folder.Name);
         folder.FolderPath     = SuppressingPiiData.Redact(folder.FolderPath, out raw, out redacted);
         folder.MailboxOwnerId = SuppressingPiiData.Redact(folder.MailboxOwnerId, out raw, out redacted);
         return(folder);
     }
     return(folder);
 }
        public MailboxFolderIdParameter(MailboxFolder mailboxFolder)
        {
            if (mailboxFolder == null)
            {
                throw new ArgumentNullException("mailboxFolder");
            }
            ObjectId identity = mailboxFolder.Identity;

            if (identity == null)
            {
                throw new ArgumentNullException("mailboxFolder.Identity");
            }
            this.rawIdentity = identity.ToString();
            ((IIdentityParameter)this).Initialize(identity);
        }
        public IEnumerable<MailboxFolder> Folders(int userId)
        {
            List<MailboxFolder> mailboxFolders = new List<MailboxFolder>();

            var userEmails = _context.UserEmail
                .Where(e => e.UserId == userId)
                .GroupBy(e => e.CategoryId)
                .ToList();

            foreach (var group in userEmails)
            {
                MailboxFolder folder = new MailboxFolder()
                {
                    Category = group.Key,
                    TotalEmails = group.Count(),
                    UnreadEmails = group.Where(e => e.IsRead == false).Count()
                };

                mailboxFolders.Add(folder);
            }


            return mailboxFolders;
        }