Exemple #1
0
        // Token: 0x0600105A RID: 4186 RVA: 0x0005F57C File Offset: 0x0005D77C
        private bool ProcessNextChunk(DtmfMapGeneratorTaskContext taskContext)
        {
            base.Logger.TraceDebug(this, "Entering DtmfMapGenerator.ProcessNextChunk", new object[0]);
            IRecipientSession writableSession = this.CreateWritableSession(base.RunData.OrgId);
            List <ADObjectId> recipientIds;
            bool recipientIds2 = this.GetRecipientIds(taskContext, out recipientIds);

            if (recipientIds.Count > 0)
            {
                Result <ADRecipient>[] recipients = null;
                Exception ex = Utilities.RunSafeADOperation(this.Trace, delegate
                {
                    recipients = writableSession.ReadMultiple(recipientIds.ToArray());
                }, "DtmfMapGenerator.ProcessNextChunk: Batched read of users matching given list of ADObjectIds");
                if (ex != null)
                {
                    throw ex;
                }
                for (int i = 0; i < recipients.Length; i++)
                {
                    Result <ADRecipient> result = recipients[i];
                    if (result.Error == null)
                    {
                        ADRecipient recipient = result.Data;
                        Utilities.RunSafeADOperation(this.Trace, delegate
                        {
                            this.Logger.TraceDebug(this, "DtmfMapGenerator.ProcessNextChunk - Processing recipient='{0}'", new object[]
                            {
                                recipient
                            });
                            recipient.PopulateDtmfMap(true);
                            if (recipient.UMDtmfMap.Changed)
                            {
                                writableSession.Save(recipient);
                            }
                        }, "DtmfMapGenerator.ProcessNextChunk : Calculating and saving DTMF map for user");
                    }
                    else
                    {
                        UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapUpdateFailed, null, new object[]
                        {
                            recipientIds[i],
                            base.RunData.TenantId,
                            base.RunData.RunId
                        });
                    }
                    base.RunData.ThrowIfShuttingDown();
                }
            }
            base.Logger.TraceDebug(this, "DtmfMapGenerator.ProcessNextChunk - Number of recipients processed='{0}'", new object[]
            {
                recipientIds.Count
            });
            return(recipientIds2);
        }
Exemple #2
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADRecipient adrecipient = (ADRecipient)base.PrepareDataObject();

            if (!adrecipient.EmailAddressPolicyEnabled && adrecipient.PrimarySmtpAddress != adrecipient.OriginalPrimarySmtpAddress && adrecipient.WindowsEmailAddress == adrecipient.OriginalWindowsEmailAddress)
            {
                adrecipient.WindowsEmailAddress = adrecipient.PrimarySmtpAddress;
            }
            if (this.CreateDTMFMap)
            {
                adrecipient.PopulateDtmfMap(true);
            }
            if (base.Fields.IsModified(ADRecipientSchema.ArbitrationMailbox))
            {
                if (this.arbitrationMbx != null)
                {
                    if (!adrecipient.OrganizationId.Equals(this.arbitrationMbx.OrganizationId))
                    {
                        base.WriteError(new RecipientTaskException(Strings.ErrorArbitrationMbxCrossOrg(this.arbitrationMbx.Identity.ToString())), ExchangeErrorCategory.Client, adrecipient.Identity);
                    }
                    adrecipient.ArbitrationMailbox = this.arbitrationMbx.Id;
                }
                else
                {
                    adrecipient.ArbitrationMailbox = null;
                }
            }
            MultiValuedProperty <string> source;

            if (!this.isDeletingMailTipTranslations && this.isDeletingDefaultMailTip && adrecipient.TryGetOriginalValue <MultiValuedProperty <string> >(ADRecipientSchema.MailTipTranslations, out source))
            {
                if (source.Any((string translation) => !ADRecipient.IsDefaultTranslation(translation)))
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorMailTipRemoveDefaultAndTranslationsExist), ExchangeErrorCategory.Client, null);
                }
            }
            TaskLogger.LogExit();
            return(adrecipient);
        }