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(); } }
public static MailboxFolder ResolveMailboxFolder(MailboxFolderIdParameter folderId, DataAccessHelper.GetDataObjectDelegate getUserHandler, DataAccessHelper.GetDataObjectDelegate getFolderHandler, IRecipientSession resolveUserSession, ADSessionSettings sessionSettings, ADUser adUser, ManageInboxRule.ThrowTerminatingErrorDelegate errorHandler) { if (!ManageInboxRule.TryValidateFolderId(folderId, getUserHandler, getFolderHandler, resolveUserSession, adUser, errorHandler)) { return(null); } MailboxFolder result; using (MailboxFolderDataProvider mailboxFolderDataProvider = new MailboxFolderDataProvider(sessionSettings, adUser, "ResolveMailboxFolder")) { result = (MailboxFolder)getFolderHandler(folderId, mailboxFolderDataProvider, null, null, new LocalizedString?(Strings.ErrorMailboxFolderNotFound(folderId.ToString())), new LocalizedString?(Strings.ErrorMailboxFolderNotUnique(folderId.ToString()))); } return(result); }
private UMMailboxConfiguration GetPresentationObject(UMSubscriber subscriber) { UMMailboxConfiguration ummailboxConfiguration = new UMMailboxConfiguration(this.DataObject.Identity); ummailboxConfiguration.Greeting = subscriber.ConfigFolder.CurrentMailboxGreetingType; ummailboxConfiguration.DefaultPlayOnPhoneNumber = subscriber.ConfigFolder.PlayOnPhoneDialString; ummailboxConfiguration.ReadOldestUnreadVoiceMessagesFirst = subscriber.ConfigFolder.ReadUnreadVoicemailInFIFOOrder; ummailboxConfiguration.ReceivedVoiceMailPreviewEnabled = subscriber.ConfigFolder.ReceivedVoiceMailPreviewEnabled; ummailboxConfiguration.SentVoiceMailPreviewEnabled = subscriber.ConfigFolder.SentVoiceMailPreviewEnabled; byte[] entryId = Convert.FromBase64String(subscriber.ConfigFolder.TelephoneAccessFolderEmail); StoreObjectId storeObjectId = StoreObjectId.FromProviderSpecificId(entryId); ADUser dataObject = this.DataObject; MailboxFolderId identity = new MailboxFolderId(dataObject.Id, storeObjectId, null); using (MailboxFolderDataProvider mailboxFolderDataProvider = new MailboxFolderDataProvider(base.SessionSettings, this.DataObject, "get-ummailboxconfiguration")) { ummailboxConfiguration.FolderToReadEmailsFrom = (MailboxFolder)mailboxFolderDataProvider.Read <MailboxFolder>(identity); } return(ummailboxConfiguration); }