protected override IConfigDataProvider CreateSession()
        {
            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);
            return(base.CreateSession());
        }
Example #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());
        }
        protected sealed override IConfigDataProvider CreateSession()
        {
            OrganizationIdParameter organization = null;

            if (MapiTaskHelper.IsDatacenter)
            {
                organization = MapiTaskHelper.ResolveTargetOrganizationIdParameter(this.Organization, this.Identity, base.CurrentOrganizationId, new Task.ErrorLoggerDelegate(base.ThrowTerminatingError), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            }
            base.CurrentOrganizationId = MapiTaskHelper.ResolveTargetOrganization(base.DomainController, organization, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
            this.rootId = null;
            if ((this.Recurse.IsPresent || this.GetChildren.IsPresent) && this.Identity != null)
            {
                this.rootId   = this.Identity.PublicFolderId;
                this.Identity = null;
            }
            if (this.publicFolderDataProvider == null || base.CurrentOrganizationId != this.publicFolderDataProvider.CurrentOrganizationId)
            {
                if (this.publicFolderDataProvider != null)
                {
                    this.publicFolderDataProvider.Dispose();
                    this.publicFolderDataProvider = null;
                }
                Guid mailboxGuid = Guid.Empty;
                if (base.Fields.IsModified("Mailbox"))
                {
                    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())), ExchangeErrorCategory.Client);
                    this.VerifyIsPublicFolderMailbox(aduser);
                    mailboxGuid = aduser.ExchangeGuid;
                }
                try
                {
                    this.publicFolderDataProvider = new PublicFolderDataProvider(this.ConfigurationSession, "Get-PublicFolder", mailboxGuid);
                }
                catch (AccessDeniedException exception)
                {
                    base.WriteError(exception, ErrorCategory.PermissionDenied, this.Identity);
                }
            }
            if (this.ResidentFolders.IsPresent)
            {
                this.contentMailboxGuid = this.publicFolderDataProvider.PublicFolderSession.MailboxGuid;
                this.inputFilter        = new ComparisonFilter(ComparisonOperator.Equal, FolderSchema.ReplicaListBinary, this.contentMailboxGuid.ToByteArray());
            }
            return(this.publicFolderDataProvider);
        }
        protected override IConfigDataProvider CreateSession()
        {
            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);
            if (this.publicFolderDataProvider == null || base.CurrentOrganizationId != this.publicFolderDataProvider.CurrentOrganizationId)
            {
                if (this.OverrideContentMailbox != null)
                {
                    IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, base.SessionSettings, 337, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MapiTasks\\PublicFolder\\SetPublicFolder.cs");
                    ADUser            aduser = (ADUser)base.GetDataObject <ADUser>(this.OverrideContentMailbox, tenantOrRootOrgRecipientSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(this.OverrideContentMailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(this.OverrideContentMailbox.ToString())));
                    if (aduser == null || aduser.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox)
                    {
                        base.WriteError(new RecipientTaskException(Strings.ErrorInvalidContentMailbox(this.OverrideContentMailbox.ToString())), ErrorCategory.InvalidArgument, aduser);
                    }
                    if (TenantPublicFolderConfigurationCache.Instance.GetValue(base.CurrentOrganizationId).GetLocalMailboxRecipient(aduser.ExchangeGuid) == null)
                    {
                        TenantPublicFolderConfigurationCache.Instance.RemoveValue(base.CurrentOrganizationId);
                    }
                    this.contentMailboxGuid = aduser.ExchangeGuid;
                }
                if (this.publicFolderDataProvider != null)
                {
                    this.publicFolderDataProvider.Dispose();
                    this.publicFolderDataProvider = null;
                }
                try
                {
                    this.publicFolderDataProvider = new PublicFolderDataProvider(this.ConfigurationSession, "Set-PublicFolder", Guid.Empty);
                }
                catch (AccessDeniedException exception)
                {
                    base.WriteError(exception, ErrorCategory.PermissionDenied, this.Identity);
                }
            }
            return(this.publicFolderDataProvider);
        }
Example #5
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());
        }
Example #6
0
        protected sealed override IConfigDataProvider CreateSession()
        {
            OrganizationIdParameter organization = null;

            if (MapiTaskHelper.IsDatacenter)
            {
                organization = MapiTaskHelper.ResolveTargetOrganizationIdParameter(this.Organization, 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 (this.publicFolderStatisticsDataProvider == null || base.CurrentOrganizationId != this.publicFolderStatisticsDataProvider.CurrentOrganizationId)
            {
                if (this.publicFolderStatisticsDataProvider != null)
                {
                    this.publicFolderStatisticsDataProvider.Dispose();
                    this.publicFolderStatisticsDataProvider = null;
                }
                Guid mailboxGuid = Guid.Empty;
                if (base.Fields.IsModified("MailboxInformation"))
                {
                    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())), ExchangeErrorCategory.Client);
                    if (aduser == null || aduser.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox)
                    {
                        base.WriteError(new ObjectNotFoundException(Strings.PublicFolderMailboxNotFound), ExchangeErrorCategory.Client, aduser);
                    }
                    mailboxGuid = aduser.ExchangeGuid;
                }
                try
                {
                    this.publicFolderStatisticsDataProvider = new PublicFolderStatisticsDataProvider(this.ConfigurationSession, "Get-PublicFolderStatistics", mailboxGuid);
                }
                catch (AccessDeniedException exception)
                {
                    base.WriteError(exception, ErrorCategory.PermissionDenied, this.Identity);
                }
            }
            return(this.publicFolderStatisticsDataProvider);
        }