Beispiel #1
0
 internal static MailboxFolderIdParameter GetMailboxFolderIdParameterForPublicFolder(IConfigurationSession configurationSession, PublicFolderIdParameter publicFolderIdParameter, Guid publicFolderMailboxGuid, ADUser publicFolderMailboxUser, OrganizationId organizationId, Task.ErrorLoggerDelegate errorHandler)
 {
     if (publicFolderMailboxUser == null)
     {
         publicFolderMailboxUser = PublicFolderPermissionTaskHelper.GetPublicFolderHierarchyMailboxUser(configurationSession);
         if (publicFolderMailboxUser == null)
         {
             errorHandler(new LocalizedException(PublicFolderSession.GetNoPublicFoldersProvisionedError(configurationSession.SessionSettings.CurrentOrganizationId)), ExchangeErrorCategory.Client, publicFolderIdParameter);
         }
     }
     if (publicFolderIdParameter.PublicFolderId.StoreObjectId == null)
     {
         using (PublicFolderDataProvider publicFolderDataProvider = new PublicFolderDataProvider(configurationSession, "*-PublicFolderClientPermission", publicFolderMailboxGuid))
         {
             StoreObjectId storeObjectId = publicFolderDataProvider.ResolveStoreObjectIdFromFolderPath(publicFolderIdParameter.PublicFolderId.MapiFolderPath);
             if (storeObjectId == null)
             {
                 errorHandler(new LocalizedException(Strings.ErrorPublicFolderNotFound(publicFolderIdParameter.ToString())), ExchangeErrorCategory.Client, publicFolderIdParameter);
             }
             publicFolderIdParameter.PublicFolderId.StoreObjectId = storeObjectId;
         }
     }
     if (publicFolderIdParameter.Organization != null)
     {
         publicFolderIdParameter.PublicFolderId.OrganizationId = organizationId;
     }
     return(new MailboxFolderIdParameter(publicFolderIdParameter, publicFolderMailboxUser));
 }
Beispiel #2
0
        protected override ADUser PrepareMailboxUser()
        {
            OrganizationIdParameter organization = null;

            if (MapiTaskHelper.IsDatacenter)
            {
                organization = MapiTaskHelper.ResolveTargetOrganizationIdParameter(null, this.Identity, base.CurrentOrganizationId, new Task.ErrorLoggerDelegate(base.ThrowTerminatingError), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            }
            base.CurrentOrganizationId = MapiTaskHelper.ResolveTargetOrganization(base.DomainController, organization, ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
            base.Identity = PublicFolderPermissionTaskHelper.GetMailboxFolderIdParameterForPublicFolder(this.ConfigurationSession, this.Identity, Guid.Empty, null, base.CurrentOrganizationId, new Task.ErrorLoggerDelegate(base.WriteError));
            return(base.PrepareMailboxUser());
        }
Beispiel #3
0
        protected override ADUser PrepareMailboxUser()
        {
            OrganizationIdParameter organization = null;
            ADUser aduser = null;
            Guid   publicFolderMailboxGuid = Guid.Empty;

            if (MapiTaskHelper.IsDatacenter)
            {
                organization = MapiTaskHelper.ResolveTargetOrganizationIdParameter(null, this.Identity, base.CurrentOrganizationId, new Task.ErrorLoggerDelegate(base.ThrowTerminatingError), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            }
            base.CurrentOrganizationId = MapiTaskHelper.ResolveTargetOrganization(base.DomainController, organization, ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
            if (base.Fields.IsModified("Mailbox"))
            {
                aduser = (ADUser)base.GetDataObject <ADUser>(this.Mailbox, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.Mailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.Mailbox.ToString())), ExchangeErrorCategory.Client);
                if (aduser == null || aduser.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox)
                {
                    base.WriteError(new ObjectNotFoundException(Strings.PublicFolderMailboxNotFound), ExchangeErrorCategory.Client, aduser);
                }
                publicFolderMailboxGuid = aduser.ExchangeGuid;
            }
            base.Identity = PublicFolderPermissionTaskHelper.GetMailboxFolderIdParameterForPublicFolder(this.ConfigurationSession, this.Identity, publicFolderMailboxGuid, aduser, base.CurrentOrganizationId, new Task.ErrorLoggerDelegate(base.WriteError));
            return(base.PrepareMailboxUser());
        }
Beispiel #4
0
 protected override void InternalProcessRecord()
 {
     base.InternalProcessRecord();
     PublicFolderPermissionTaskHelper.SyncPublicFolder(this.ConfigurationSession, this.Identity.PublicFolderId.StoreObjectId);
 }