Exemplo n.º 1
0
 internal override IConfigDataProvider CreateXsoMailboxDataProvider(ExchangePrincipal principal, ISecurityAccessToken userToken)
 {
     return(new CalendarConfigurationDataProvider(principal, "Set-CalendarProcessing"));
 }
Exemplo n.º 2
0
 private ExchangePrincipal GetArchivePrincipal(ExchangePrincipal primaryEP, ADUser adUser)
 {
     return(primaryEP.GetArchiveExchangePrincipal(RemotingOptions.AllowCrossSite | RemotingOptions.AllowCrossPremise));
 }
        private static MailboxSession OpenMailboxSessionAsAdmin(ADUser user, string userAgent)
        {
            ExchangePrincipal mailboxOwner = ExchangePrincipal.FromADUser(user, null);

            return(MailboxSession.OpenAsAdmin(mailboxOwner, CultureInfo.InvariantCulture, userAgent));
        }
Exemplo n.º 4
0
        private IList <ExchangePrincipal> GetSyncMailboxPrincipals(Guid mailboxDatabaseGuid, IDirectorySession configSession)
        {
            List <ExchangePrincipal> list = new List <ExchangePrincipal>();
            ADObjectId id = new ADObjectId(mailboxDatabaseGuid);

            Result <MailboxDatabase>[] dataBases         = null;
            ADOperationResult          adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                dataBases = configSession.FindByADObjectIds <MailboxDatabase>(new ADObjectId[]
                {
                    id
                });
            }, 3);

            if (!adoperationResult.Succeeded)
            {
                this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: failed to find database {0} in active directory because of {1}", mailboxDatabaseGuid, adoperationResult.Exception), adoperationResult.Exception);
            }
            if (dataBases != null && dataBases.Length > 0)
            {
                PartitionId[] allAccountPartitionIds = ADAccountPartitionLocator.GetAllAccountPartitionIds();
                for (int i = 0; i < allAccountPartitionIds.Length; i++)
                {
                    PartitionId       partitionId      = allAccountPartitionIds[i];
                    IRecipientSession recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 238, "GetSyncMailboxPrincipals", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\UnifiedPolicy\\NotificationLoader.cs");
                    ADUser[]          arbMbxs          = null;
                    adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
                    {
                        arbMbxs = recipientSession.FindPaged <ADUser>(RecipientFilterHelper.DiscoveryMailboxFilterUnifiedPolicy(dataBases[0].Data.Id), null, true, null, 0).ToArray <ADUser>();
                    }, 3);
                    if (!adoperationResult.Succeeded)
                    {
                        this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: failed to find sync mailboxes in database {0} in active directory because of {1}", mailboxDatabaseGuid, adoperationResult.Exception), adoperationResult.Exception);
                    }
                    if (arbMbxs != null && arbMbxs.Length > 0)
                    {
                        ADUser[] arbMbxs2 = arbMbxs;
                        int      j        = 0;
                        while (j < arbMbxs2.Length)
                        {
                            ADUser aduser = arbMbxs2[j];
                            this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Verbose, string.Format("GetSyncMailboxPrincipals: found sync mailbox {0} in database {1} in partition {2}", aduser.UserPrincipalName, mailboxDatabaseGuid, partitionId), null);
                            ExchangePrincipal item = null;
                            try
                            {
                                item = ExchangePrincipal.FromADUser(ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(aduser.OrganizationId), aduser, RemotingOptions.LocalConnectionsOnly);
                            }
                            catch (StoragePermanentException exception)
                            {
                                this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: sync mailbox {0} is skipped because of StoragePermanentException in ExchangePrincipal construction", aduser.UserPrincipalName), exception);
                                goto IL_20F;
                            }
                            catch (StorageTransientException exception2)
                            {
                                this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Error, string.Format("GetSyncMailboxPrincipals: sync mailbox {0} is skipped because of StorageTransientException in ExchangePrincipal construction", aduser.UserPrincipalName), exception2);
                                goto IL_20F;
                            }
                            goto IL_207;
IL_20F:
                            j++;
                            continue;
IL_207:
                            list.Add(item);
                            goto IL_20F;
                        }
                    }
                    else
                    {
                        this.logger.LogOneEntry("NotificationLoader", string.Empty, ExecutionLog.EventType.Verbose, string.Format("GetSyncMailboxPrincipals: there is no sync mailboxes in database {0} in active directory", mailboxDatabaseGuid), null);
                    }
                }
            }
            return(list);
        }
Exemplo n.º 5
0
 // Token: 0x06000654 RID: 1620
 internal abstract MailboxSession CreateInstantSearchMailboxSession(ExchangePrincipal exchangePrincipal, CultureInfo cultureInfo);
Exemplo n.º 6
0
        internal ExchangePrincipal GetMailboxOwner(QueryFilter filter)
        {
            ADUser recipient = this.GetRecipient <ADUser>(this.RecipientSession, filter);

            return(ExchangePrincipal.FromADUser(this.RecipientSession.SessionSettings, recipient, RemotingOptions.AllowCrossSite));
        }
Exemplo n.º 7
0
 internal override IConfigDataProvider CreateXsoMailboxDataProvider(ExchangePrincipal principal, ISecurityAccessToken userToken)
 {
     return(new VersionedXmlDataProvider(principal, userToken, "Set-CalendarNotification"));
 }
 public MailboxDiagnosticLogsDataProvider(string componentName, ExchangePrincipal exchangePrincipal, string action) : this(exchangePrincipal, action)
 {
     this.getProperties = false;
     this.componentName = componentName;
 }
 private static ExchangePrincipal GetExchangePrincipalFromADUser(ADUser targetUser)
 {
     return(ExchangePrincipal.FromADUser(targetUser, RemotingOptions.AllowCrossSite));
 }
Exemplo n.º 10
0
 private static IMailboxSession NoHostOwnedMailboxSession(ExchangePrincipal target)
 {
     return(null);
 }
 public MailboxDiagnosticLogsDataProvider(ExchangePrincipal exchangePrincipal, string action) : base(exchangePrincipal, action)
 {
 }
Exemplo n.º 12
0
 private IMailboxSession GetMailboxSessionOfRequestor(ExchangePrincipal target)
 {
     return(base.MailboxIdentityMailboxSession);
 }
        private static void ConvertLegacyItemIdFormatIfNecessary(SimpleConfiguration <OtherMailboxConfigEntry> otherMailboxConfig, CallContext callContext)
        {
            bool flag = false;

            for (int i = otherMailboxConfig.Entries.Count - 1; i >= 0; i--)
            {
                OtherMailboxConfigEntry otherMailboxConfigEntry = otherMailboxConfig.Entries[i];
                if (!string.IsNullOrEmpty(otherMailboxConfigEntry.InboxFolderOwaStoreObjectId))
                {
                    flag = true;
                    bool flag2 = false;
                    try
                    {
                        OwaStoreObjectId  owaStoreObjectId  = OwaStoreObjectId.CreateFromString(otherMailboxConfigEntry.InboxFolderOwaStoreObjectId);
                        ExchangePrincipal exchangePrincipal = (owaStoreObjectId.MailboxOwnerLegacyDN != null) ? ExchangePrincipal.FromLegacyDN(callContext.SessionCache.GetMailboxIdentityMailboxSession().GetADSessionSettings(), owaStoreObjectId.MailboxOwnerLegacyDN) : callContext.AccessingPrincipal;
                        otherMailboxConfigEntry.PrincipalSMTPAddress        = exchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString();
                        otherMailboxConfigEntry.InboxFolderOwaStoreObjectId = null;
                        flag2 = true;
                    }
                    catch (OwaInvalidIdFormatException)
                    {
                    }
                    catch (OwaInvalidRequestException)
                    {
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                    finally
                    {
                        if (!flag2)
                        {
                            otherMailboxConfig.Entries.RemoveAt(i);
                        }
                    }
                }
            }
            if (flag)
            {
                otherMailboxConfig.Save(callContext);
            }
        }
Exemplo n.º 14
0
        // Token: 0x06002F03 RID: 12035 RVA: 0x0010E7F4 File Offset: 0x0010C9F4
        private void PlayOnPhone(bool isPAA)
        {
            string text         = (string)base.GetParameter("phNum");
            string lastUMCallId = base.UserContext.LastUMCallId;

            using (UMClientCommon umclientCommon = new UMClientCommon(base.UserContext.ExchangePrincipal))
            {
                if (!umclientCommon.IsPlayOnPhoneEnabled())
                {
                    throw new OwaEventHandlerException("User is not enabled for Play on Phone", LocalizedStrings.GetNonEncoded(1385527863));
                }
                if (!string.IsNullOrEmpty(lastUMCallId))
                {
                    UMCallState umcallState = UMCallState.Disconnected;
                    try
                    {
                        UMCallInfo callInfo = umclientCommon.GetCallInfo(lastUMCallId);
                        umcallState = callInfo.CallState;
                    }
                    catch (InvalidCallIdException)
                    {
                        ExTraceGlobals.UnifiedMessagingTracer.TraceDebug((long)this.GetHashCode(), "Failed to get call status from Unified Messaging");
                    }
                    catch (Exception exception)
                    {
                        if (this.HandleUMException(exception))
                        {
                            return;
                        }
                        throw;
                    }
                    if (umcallState != UMCallState.Disconnected)
                    {
                        base.RenderPartialFailure(460647110, new Strings.IDs?(-937065163), ButtonDialogIcon.Warning);
                        return;
                    }
                    base.UserContext.LastUMCallId = null;
                }
                try
                {
                    if (isPAA)
                    {
                        string s           = (string)base.GetParameter("paaID");
                        Guid   paaIdentity = new Guid(Convert.FromBase64String(s));
                        base.UserContext.LastUMCallId = umclientCommon.PlayOnPhonePAAGreeting(paaIdentity, text);
                    }
                    else
                    {
                        OwaStoreObjectId  owaStoreObjectId             = (OwaStoreObjectId)base.GetParameter("msgID");
                        ExchangePrincipal playOnPhoneExchangePrincipal = this.GetPlayOnPhoneExchangePrincipal(owaStoreObjectId);
                        using (UMClientCommon umclientCommon2 = new UMClientCommon(playOnPhoneExchangePrincipal))
                        {
                            string base64ObjectId = Utilities.ProviderSpecificIdFromStoreObjectId(owaStoreObjectId.StoreObjectId.ToBase64String());
                            base.UserContext.LastUMCallId = umclientCommon2.PlayOnPhone(base64ObjectId, text);
                        }
                    }
                    base.UserContext.LastUMPhoneNumber = text;
                    if (string.Compare(umclientCommon.GetUMProperties().PlayOnPhoneDialString, text, StringComparison.InvariantCultureIgnoreCase) != 0)
                    {
                        umclientCommon.SetPlayOnPhoneDialString(text);
                    }
                }
                catch (Exception exception2)
                {
                    if (this.HandleUMException(exception2))
                    {
                        return;
                    }
                    throw;
                }
                this.Writer.Write(base.UserContext.LastUMCallId);
            }
        }
Exemplo n.º 15
0
        private void SetSenderAndMessageId(ADUser mailbox)
        {
            string text  = string.Empty;
            string text2 = string.Empty;

            ExTraceGlobals.SearchLibraryTracer.TraceError((long)this.GetHashCode(), "EID: " + this.MessageEntryId);
            byte[] entryId;
            try
            {
                entryId = Convert.FromBase64String(this.MessageEntryId);
            }
            catch (FormatException e)
            {
                this.HandleError("Could not decode base64 value: " + this.MessageEntryId, Strings.InvalidMessageIdentity, e);
                return;
            }
            StoreObjectId itemId;

            try
            {
                itemId = StoreObjectId.FromProviderSpecificId(entryId);
            }
            catch (CorruptDataException e2)
            {
                this.HandleError("Could not create store ID from base64 decoded value.", Strings.InvalidMessageIdentity, e2);
                return;
            }
            ExchangePrincipal exchangePrincipal;

            try
            {
                exchangePrincipal = ExchangePrincipal.FromADUser(base.TenantGlobalCatalogSession.SessionSettings, mailbox, RemotingOptions.AllowCrossSite);
                using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(exchangePrincipal, CultureInfo.InvariantCulture, "Client=Management;Action=Search-MessageTrackingReport"))
                {
                    PropertyDefinition[] propsToReturn = new PropertyDefinition[]
                    {
                        MessageItemSchema.SenderAddressType,
                        MessageItemSchema.SenderEmailAddress,
                        ItemSchema.InternetMessageId,
                        ItemSchema.SentTime,
                        ItemSchema.Subject,
                        StoreObjectSchema.ItemClass
                    };
                    using (MessageItem messageItem = Item.BindAsMessage(mailboxSession, itemId, propsToReturn))
                    {
                        object obj = messageItem.TryGetProperty(ItemSchema.InternetMessageId);
                        if (!(obj is PropertyError))
                        {
                            this.MessageId = (string)obj;
                        }
                        obj = messageItem.TryGetProperty(MessageItemSchema.SenderAddressType);
                        if (!(obj is PropertyError))
                        {
                            text = (string)obj;
                        }
                        obj = messageItem.TryGetProperty(MessageItemSchema.SenderEmailAddress);
                        if (!(obj is PropertyError))
                        {
                            text2 = (string)obj;
                        }
                        obj = messageItem.TryGetProperty(ItemSchema.SentTime);
                        if (!(obj is PropertyError))
                        {
                            this.clientSubmitTime = new ExDateTime?((ExDateTime)obj);
                        }
                        obj = messageItem.TryGetProperty(ItemSchema.Subject);
                        if (!(obj is PropertyError))
                        {
                            this.storeItemSubject = (string)obj;
                        }
                        obj = messageItem.TryGetProperty(StoreObjectSchema.ItemClass);
                        if (!(obj is PropertyError))
                        {
                            this.messageClass = (string)obj;
                        }
                    }
                }
            }
            catch (StorageTransientException ex)
            {
                this.HandleError("StorageTransientException trying to retrieve message data: " + ex.Message + "|" + ex.ToString(), Strings.TrackingTransientError, Strings.ExceptionStorageOther(ex.ErrorCode, ex.Message), ex, ErrorCategory.ReadError);
                return;
            }
            catch (StoragePermanentException ex2)
            {
                this.HandleError("StoragePermanentException trying to retrieve message data: " + ex2.Message + "|" + ex2.ToString(), Strings.TrackingPermanentError, Strings.ExceptionStorageOther(ex2.ErrorCode, ex2.Message), ex2, ErrorCategory.InvalidOperation);
                return;
            }
            if (string.IsNullOrEmpty(text))
            {
                this.HandleError("Could not determine sender's routing type.", CoreStrings.InvalidSender);
            }
            else
            {
                if (string.IsNullOrEmpty(text2))
                {
                    this.HandleError("Could not determine sender's email address.", CoreStrings.InvalidSender);
                    return;
                }
                if (!SupportedMessageClasses.Classes.Contains(this.messageClass))
                {
                    ExTraceGlobals.TaskTracer.TraceError <string>((long)this.GetHashCode(), "PR_MESSAGE_CLASS: {0} not supported for tracking", this.messageClass);
                    base.WriteError(new TrackingExceptionMessageTypeNotSupported(), ErrorCategory.InvalidType, null);
                }
                SmtpAddress value = SmtpAddress.Empty;
                if (string.CompareOrdinal(text, "EX") == 0)
                {
                    try
                    {
                        ADRecipient adrecipient = base.TenantGlobalCatalogSession.FindByLegacyExchangeDN(text2);
                        if (adrecipient == null)
                        {
                            this.HandleError("Could not resolve the sender in AD.", CoreStrings.InvalidSender);
                            return;
                        }
                        value = adrecipient.PrimarySmtpAddress;
                        goto IL_383;
                    }
                    catch (ObjectNotFoundException e3)
                    {
                        this.HandleError("Could not resolve the sender in AD, the sender is not found.", CoreStrings.InvalidSender, e3);
                        return;
                    }
                    catch (NonUniqueRecipientException e4)
                    {
                        this.HandleError("Could not resolve the sender in AD, the sender is non-unique.", CoreStrings.InvalidSender, e4);
                        return;
                    }
                }
                if (string.CompareOrdinal(text, "SMTP") != 0)
                {
                    this.HandleError("Sender's routing type is not supported: " + text, CoreStrings.InvalidSender);
                    return;
                }
                value = new SmtpAddress(text2);
IL_383:
                if (!value.Equals(exchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString()))
                {
                    this.Sender = new SmtpAddress?(value);
                }
                return;
            }
        }
Exemplo n.º 16
0
        private bool AcquireADObjectsForPrivateMdb()
        {
            if (MdbSystemMailboxPinger.OnTestPing != null)
            {
                return(true);
            }
            bool flag = false;

            try
            {
                if (this.principal != null)
                {
                    if (!this.VerifyLocalBoxCall(this.principal.MailboxInfo.Location.ServerFqdn))
                    {
                        return(false);
                    }
                    flag = true;
                    return(true);
                }
                else
                {
                    if ((this.pingerState == MdbSystemMailboxPinger.PingerState.NeedReinitialization || this.pingerState == MdbSystemMailboxPinger.PingerState.NotInitialized) && TimeProvider.UtcNow - this.lastSessionAttemptUtc < MdbSystemMailboxPinger.OpenSessionAttemptInterval)
                    {
                        ExTraceGlobals.DatabasePingerTracer.TraceDebug((long)this.GetHashCode(), "Need to acquire principal, but not enough time has passed between attempts.");
                        return(false);
                    }
                    this.lastSessionAttemptUtc = TimeProvider.UtcNow;
                    ActiveManager        noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance();
                    DatabaseLocationInfo serverForDatabase = noncachingActiveManagerInstance.GetServerForDatabase(this.databaseGuid, true);
                    if (!this.VerifyLocalBoxCall(serverForDatabase.ServerFqdn))
                    {
                        return(false);
                    }
                    ADSessionSettings adsessionSettings = ADSessionSettings.FromRootOrgScopeSet();
                    ADSystemMailbox   adSystemMailbox   = this.FindSystemMailbox(adsessionSettings);
                    Server            server            = this.FindMdbServer(adsessionSettings, serverForDatabase.ServerFqdn);
                    if (server == null)
                    {
                        ExTraceGlobals.DatabasePingerTracer.TraceError <string>((long)this.GetHashCode(), "[MdbSystemMailboxPinger.AcquireADObjectsForPrivateMdb] Failed to find server with FQDN: '{0}'", serverForDatabase.ServerFqdn);
                        return(false);
                    }
                    this.principal  = ExchangePrincipal.FromADSystemMailbox(adsessionSettings, adSystemMailbox, server);
                    this.accessInfo = new MailboxAccessInfo(new WindowsPrincipal(WindowsIdentity.GetCurrent()));
                    flag            = true;
                }
            }
            catch (StoragePermanentException arg)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "Encountered StoragePermanentException obtaining ExchangePrincipal.  Exception: {0}", arg);
            }
            catch (StorageTransientException arg2)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <StorageTransientException>((long)this.GetHashCode(), "Encountered StorageTransientException obtaining ExchangePrincipal.  Exception: {0}", arg2);
            }
            catch (DataSourceOperationException arg3)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <DataSourceOperationException>((long)this.GetHashCode(), "EncounteredDataSourceOperationException obtaining ExchangePrincipal.  Exception :{0}", arg3);
            }
            catch (DataSourceTransientException arg4)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <DataSourceTransientException>((long)this.GetHashCode(), "Encountered DataSourceTransientException obtaining ExchangePrincipal.  Exception :{0}", arg4);
            }
            finally
            {
                if (!flag)
                {
                    this.principal = null;
                    this.DisposeAccessInfo();
                }
            }
            return(flag);
        }
Exemplo n.º 17
0
 internal abstract IConfigDataProvider InternalCreateSearchDataProvider(ExchangePrincipal principal, OrganizationId organizationId);
 // Token: 0x06000697 RID: 1687 RVA: 0x00013C43 File Offset: 0x00011E43
 internal override MailboxSession CreateInstantSearchMailboxSession(ExchangePrincipal exchangePrincipal, CultureInfo cultureInfo)
 {
     return(null);
 }
Exemplo n.º 19
0
 // Token: 0x06000743 RID: 1859 RVA: 0x0001C625 File Offset: 0x0001A825
 private void GetClientAndRootFolderId(ExchangePrincipal principal, ref EwsAuditClient ewsClient, ref FolderIdType auditRootFolderId)
 {
     ewsClient         = (ewsClient ?? new EwsAuditClient(new EwsConnectionManager(principal, OpenAsAdminOrSystemServiceBudgetTypeType.Unthrottled, this.Tracer), EwsAuditClient.DefaultSoapClientTimeout, this.Tracer));
     auditRootFolderId = (auditRootFolderId ?? AdminAuditWriter.GetAuditRootFolderId(ewsClient));
 }
 // Token: 0x06000698 RID: 1688 RVA: 0x00013C46 File Offset: 0x00011E46
 internal override MailboxSession CreateDelegateMailboxSession(ExchangePrincipal exchangePrincipal, CultureInfo cultureInfo)
 {
     return(null);
 }
Exemplo n.º 21
0
        // Token: 0x060008FA RID: 2298 RVA: 0x0003CBC0 File Offset: 0x0003ADC0
        internal void UpdateAllUserSettings(IRecipientSession recipientSession, long cookie, Initiating.ActOnUserSettingsDelegate updateUserSettings, Predicate <ADRawEntry> validate)
        {
            QueryFilter filter = new AndFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.Database, new ADObjectId(base.Context.Guid)),
                new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox)
            });
            ADPagedReader <ADRawEntry> adpagedReader = recipientSession.FindPagedADRawEntry(null, QueryScope.SubTree, filter, null, 0, new PropertyDefinition[]
            {
                ADObjectSchema.Id,
                ADRecipientSchema.TextMessagingState,
                IADMailStorageSchema.ExchangeGuid
            });

            using (IEnumerator <ADRawEntry> enumerator = adpagedReader.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ADRawEntry recipient = enumerator.Current;
                    if (!base.ShouldContinue(cookie))
                    {
                        break;
                    }
                    if (validate == null || validate(recipient))
                    {
                        if (this.mailboxTable == null)
                        {
                            this.mailboxTable = base.Context.GetMailboxTable(ClientType.EventBased, new PropertyTagPropertyDefinition[0]);
                        }
                        if (!this.mailboxTable.Exists((MailboxInformation mbxInfo) => mbxInfo.MailboxGuid == (Guid)recipient[IADMailStorageSchema.ExchangeGuid]))
                        {
                            ADUser aduser = recipientSession.FindADUserByObjectId((ADObjectId)recipient[ADObjectSchema.Id]);
                            if (aduser != null)
                            {
                                ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(aduser, null);
                                MailboxSession    mailboxSession    = null;
                                try
                                {
                                    mailboxSession = base.Context.GetMailbox(exchangePrincipal, ClientType.EventBased, "UpdateAllUserSettings");
                                    if (!base.ShouldContinue(cookie))
                                    {
                                        break;
                                    }
                                    updateUserSettings(mailboxSession, recipientSession, aduser);
                                }
                                catch (NotSupportedException arg)
                                {
                                    ExTraceGlobals.AssistantTracer.TraceError <string, NotSupportedException>((long)this.GetHashCode(), "Exception is caught during syncing text messaging settings to AD user object for {0}: {1}", exchangePrincipal.LegacyDn, arg);
                                }
                                catch (Exception ex)
                                {
                                    if (!CalendarNotificationAssistant.TryHandleException((long)this.GetHashCode(), "Update all user's settings", exchangePrincipal.LegacyDn, ex))
                                    {
                                        throw;
                                    }
                                }
                                finally
                                {
                                    if (mailboxSession != null)
                                    {
                                        mailboxSession.Dispose();
                                        mailboxSession = null;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
 // Token: 0x06000699 RID: 1689 RVA: 0x00013C49 File Offset: 0x00011E49
 internal override ExchangePrincipal InternalCreateExchangePrincipal()
 {
     ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaMiniRecipientIdentity.InternalCreateExchangePrincipal");
     return(ExchangePrincipal.FromMiniRecipient(base.OwaMiniRecipient));
 }
Exemplo n.º 23
0
        // Token: 0x06000651 RID: 1617 RVA: 0x00012B64 File Offset: 0x00010D64
        internal ExchangePrincipal CreateExchangePrincipal()
        {
            ExchangePrincipal exchangePrincipal = null;

            try
            {
                if (ExTraceGlobals.CoreTracer.IsTraceEnabled(TraceType.DebugTrace))
                {
                    string text = null;
                    using (WindowsIdentity current = WindowsIdentity.GetCurrent())
                    {
                        text = current.Name;
                    }
                    if (string.IsNullOrEmpty(text))
                    {
                        text = "<n/a>";
                    }
                    string arg = this.SafeGetRenderableName();
                    ExTraceGlobals.CoreTracer.TraceDebug <string, string>(0L, "Using accout {0} to bind to ExchangePrincipal object for user {1}", text, arg);
                }
                exchangePrincipal = this.InternalCreateExchangePrincipal();
            }
            catch (AdUserNotFoundException innerException)
            {
                throw new OwaADUserNotFoundException(this.SafeGetRenderableName(), null, innerException);
            }
            catch (ObjectNotFoundException ex)
            {
                bool flag = false;
                DataValidationException ex2 = ex.InnerException as DataValidationException;
                if (ex2 != null)
                {
                    PropertyValidationError propertyValidationError = ex2.Error as PropertyValidationError;
                    if (propertyValidationError != null && propertyValidationError.PropertyDefinition == MiniRecipientSchema.Languages)
                    {
                        OWAMiniRecipient owaminiRecipient = this.FixCorruptOWAMiniRecipientCultureEntry();
                        if (owaminiRecipient != null)
                        {
                            try
                            {
                                exchangePrincipal = ExchangePrincipal.FromMiniRecipient(owaminiRecipient);
                                ExTraceGlobals.CoreTracer.TraceDebug <SecurityIdentifier>(0L, "OwaIdentity.CreateExchangePrincipal: Got ExchangePrincipal from MiniRecipient for Sid: {0}", this.UserSid);
                                flag = true;
                            }
                            catch (ObjectNotFoundException)
                            {
                            }
                        }
                    }
                }
                if (!flag)
                {
                    ExTraceGlobals.CoreTracer.TraceDebug <SecurityIdentifier, ObjectNotFoundException>(0L, "OwaIdentity.CreateExchangePrincipal: Fail to create ExchangePrincipal for Sid: {0}. Cannot recover from exception: {1}", this.UserSid, ex);
                    throw ex;
                }
            }
            if (exchangePrincipal == null)
            {
                ExTraceGlobals.CoreTracer.TraceDebug <SecurityIdentifier>(0L, "OwaIdentity.CreateExchangePrincipal: Got a null ExchangePrincipal for Sid: {0}", this.UserSid);
            }
            return(exchangePrincipal);
        }
        // Token: 0x0600238B RID: 9099 RVA: 0x000CC70C File Offset: 0x000CA90C
        protected internal override void BuildInfobar()
        {
            InfobarMessageBuilder.AddFlag(this.FormInfobar, this.meetingResponse, this.UserContext);
            if (this.isDraft)
            {
                this.FormInfobar.AddMessage(-1981719796, InfobarMessageType.Informational);
                string format = string.Empty;
                switch (this.meetingResponse.ResponseType)
                {
                case ResponseType.Tentative:
                    format = LocalizedStrings.GetHtmlEncoded(-588720585);
                    break;

                case ResponseType.Accept:
                    format = LocalizedStrings.GetHtmlEncoded(-14610226);
                    break;

                case ResponseType.Decline:
                    format = LocalizedStrings.GetHtmlEncoded(-1615218790);
                    break;
                }
                SanitizedHtmlString messageHtml;
                if (this.meetingResponse.From != null && string.CompareOrdinal(this.UserContext.ExchangePrincipal.LegacyDn, this.meetingResponse.From.EmailAddress) != 0)
                {
                    ADSessionSettings adSettings  = Utilities.CreateScopedADSessionSettings(this.UserContext.LogonIdentity.DomainName);
                    string            displayName = ExchangePrincipal.FromLegacyDN(adSettings, this.meetingResponse.From.EmailAddress).MailboxInfo.DisplayName;
                    messageHtml = SanitizedHtmlString.Format(format, new object[]
                    {
                        displayName
                    });
                }
                else
                {
                    messageHtml = SanitizedHtmlString.Format(format, new object[]
                    {
                        LocalizedStrings.GetNonEncoded(372029413)
                    });
                }
                this.FormInfobar.AddMessage(messageHtml, InfobarMessageType.Informational);
                return;
            }
            string s   = string.Empty;
            string arg = string.Empty;

            if (this.OriginalSender == null || string.IsNullOrEmpty(this.OriginalSender.DisplayName))
            {
                arg = LocalizedStrings.GetNonEncoded(-342979842);
            }
            else
            {
                arg = this.OriginalSender.DisplayName;
            }
            switch (this.meetingResponse.ResponseType)
            {
            case ResponseType.Tentative:
                s = string.Format(Strings.InfoAttendeeTentative, arg);
                break;

            case ResponseType.Accept:
                s = string.Format(Strings.InfoAttendeeAccepted, arg);
                break;

            case ResponseType.Decline:
                s = string.Format(Strings.InfoAttendeeDecline, arg);
                break;
            }
            this.FormInfobar.AddMessage(Utilities.SanitizeHtmlEncode(s), InfobarMessageType.Informational);
            InfobarMessageBuilder.AddImportance(this.FormInfobar, this.meetingResponse);
            InfobarMessageBuilder.AddSensitivity(this.FormInfobar, this.meetingResponse);
            if (this.isDelegated)
            {
                this.FormInfobar.AddMessage(Utilities.SanitizeHtmlEncode(string.Format(LocalizedStrings.GetNonEncoded(-1205864060), MeetingUtilities.GetReceivedOnBehalfOfDisplayName(this.meetingResponse))), InfobarMessageType.Informational);
            }
            if (!this.isEmbeddedItem && !Utilities.IsPublic(this.meetingResponse))
            {
                InfobarMessageBuilder.AddReadReceiptNotice(this.UserContext, this.FormInfobar, this.meetingResponse);
            }
        }
Exemplo n.º 25
0
 // Token: 0x06000655 RID: 1621
 internal abstract MailboxSession CreateDelegateMailboxSession(ExchangePrincipal exchangePrincipal, CultureInfo cultureInfo);
        private bool ConvertLegacyItemIdFormatIfNecessary(SimpleConfiguration <TargetFolderMRUEntry> folderMruConfig, CallContext callContext)
        {
            bool result = false;

            foreach (TargetFolderMRUEntry targetFolderMRUEntry in folderMruConfig.Entries)
            {
                if (targetFolderMRUEntry.EwsFolderIdEntry == null)
                {
                    try
                    {
                        OwaStoreObjectId  owaStoreObjectId  = OwaStoreObjectId.CreateFromString(targetFolderMRUEntry.FolderId);
                        ExchangePrincipal exchangePrincipal = (owaStoreObjectId.MailboxOwnerLegacyDN != null) ? ExchangePrincipal.FromLegacyDN(callContext.SessionCache.GetMailboxIdentityMailboxSession().GetADSessionSettings(), owaStoreObjectId.MailboxOwnerLegacyDN) : callContext.AccessingPrincipal;
                        new IdConverter(callContext);
                        FolderId folderIdFromStoreId = IdConverter.GetFolderIdFromStoreId(owaStoreObjectId.StoreId, new MailboxId(exchangePrincipal.MailboxInfo.MailboxGuid));
                        targetFolderMRUEntry.EwsFolderIdEntry = folderIdFromStoreId.Id;
                        result = true;
                    }
                    catch (OwaInvalidIdFormatException)
                    {
                    }
                    catch (OwaInvalidRequestException)
                    {
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                }
            }
            return(result);
        }
Exemplo n.º 27
0
        private void PerformArchiveConnectivityTest(ref ArchiveConnectivityOutcome result)
        {
            bool flag  = false;
            bool flag2 = false;

            try
            {
                SmtpAddress       userSmtp          = this.UserSmtp;
                ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromProxyAddress(ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(userSmtp.Domain), userSmtp.ToString());
                if (exchangePrincipal != null)
                {
                    if (this.IncludeArchiveMRMConfiguration || !string.IsNullOrEmpty(this.MessageId))
                    {
                        this.LogonPrimary(exchangePrincipal);
                        result.PrimaryMRMConfiguration  = this.primaryFAI;
                        result.PrimaryLastProcessedTime = this.primaryLastProcessedTime;
                    }
                    flag = true;
                    ADObjectId        objectId = exchangePrincipal.ObjectId;
                    IRecipientSession tenantOrRootOrgRecipientSession;
                    if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled)
                    {
                        tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.FullyConsistent, exchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings(), 276, "PerformArchiveConnectivityTest", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Monitoring\\ArchiveConnectivity\\TestArchiveConnectivityTask.cs");
                    }
                    else
                    {
                        tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 284, "PerformArchiveConnectivityTest", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Monitoring\\ArchiveConnectivity\\TestArchiveConnectivityTask.cs");
                    }
                    ADUser aduser = tenantOrRootOrgRecipientSession.FindADUserByObjectId(objectId);
                    this.complianceConfiguration   = aduser.ElcMailboxFlags.ToString();
                    result.ComplianceConfiguration = this.complianceConfiguration;
                    if (exchangePrincipal.GetArchiveMailbox() == null)
                    {
                        result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, Strings.ArchiveConnectivityResultArchiveNotProvisioned);
                    }
                    else
                    {
                        if (aduser.ArchiveDomain != null)
                        {
                            result.ArchiveDomain = aduser.ArchiveDomain.ToString();
                            flag2 = true;
                        }
                        if (aduser.ArchiveDatabase != null)
                        {
                            result.ArchiveDatabase = aduser.ArchiveDatabase.ToString();
                        }
                        if (aduser.RecipientType == RecipientType.UserMailbox)
                        {
                            if (flag2)
                            {
                                if (ArchiveStatusFlags.Active != aduser.ArchiveStatus)
                                {
                                    result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, Strings.ArchiveConnectivityResultArchiveNotActive);
                                }
                                else if (this.LogonArchive(this.GetArchivePrincipal(exchangePrincipal, aduser)))
                                {
                                    result.Update(ArchiveConnectivityResultEnum.Success, "");
                                }
                            }
                            else if (this.LogonArchive(this.GetArchivePrincipal(exchangePrincipal, aduser)))
                            {
                                result.Update(ArchiveConnectivityResultEnum.Success, "");
                            }
                        }
                        if (this.IncludeArchiveMRMConfiguration)
                        {
                            result.ArchiveMRMConfiguration  = this.archiveFAI;
                            result.ArchiveLastProcessedTime = this.archiveLastProcessedTime;
                        }
                    }
                }
                this.mrmProperties = this.mrmPropReport.ToString();
                if (!string.IsNullOrEmpty(this.mrmProperties))
                {
                    result.ItemMRMProperties = this.mrmProperties;
                }
                else if (!string.IsNullOrEmpty(this.MessageId))
                {
                    result.ItemMRMProperties = "Item not found.";
                }
            }
            catch (ObjectNotFoundException ex)
            {
                if (!flag)
                {
                    result.Update(ArchiveConnectivityResultEnum.PrimaryFailure, this.GetAllInnerExceptions(ex));
                }
                else
                {
                    result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex));
                }
            }
            catch (ConnectionFailedTransientException ex2)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex2));
            }
            catch (AutoDAccessException ex3)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex3));
            }
            catch (StoragePermanentException ex4)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex4));
            }
            catch (StorageTransientException ex5)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex5));
            }
            catch (ArgumentException ex6)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex6));
            }
        }
Exemplo n.º 28
0
 internal override IConfigDataProvider CreateXsoMailboxDataProvider(ExchangePrincipal principal, ISecurityAccessToken userToken)
 {
     return(new MailboxAutoReplyConfigurationDataProvider(principal, "Get-MailboxAutoReplyConfiguration"));
 }
Exemplo n.º 29
0
        private StoreSession OpenMailboxSession(StoreMailboxData mailbox)
        {
            Guid          activityId       = (ActivityContext.ActivityId != null) ? ActivityContext.ActivityId.Value : Guid.Empty;
            AssistantBase assistant        = this.Assistant as AssistantBase;
            string        nonLocalizedName = this.Assistant.NonLocalizedName;
            Guid          mailboxGuid      = mailbox.MailboxGuid;
            StoreSession  result;

            try
            {
                ExchangePrincipal exchangePrincipal;
                if (mailbox.TenantPartitionHint != null)
                {
                    ADSessionSettings adSettings = ADSessionSettings.FromTenantPartitionHint(mailbox.TenantPartitionHint);
                    exchangePrincipal = ExchangePrincipal.FromLocalServerMailboxGuid(adSettings, this.DatabaseInfo.Guid, mailbox.Guid);
                }
                else
                {
                    exchangePrincipal = ExchangePrincipal.FromMailboxData(mailbox.Guid, this.DatabaseInfo.Guid, mailbox.OrganizationId ?? OrganizationId.ForestWideOrgId, Array <CultureInfo> .Empty);
                }
                if (mailbox.IsPublicFolderMailbox)
                {
                    StoreSession storeSession = PublicFolderSession.OpenAsAdmin(null, exchangePrincipal, null, CultureInfo.InstalledUICulture, string.Format("{0};Action={1}", "Client=TBA", this.Assistant.GetType().Name), null);
                    AssistantsLog.LogMailboxSucceedToOpenStoreSessionEvent(activityId, nonLocalizedName, assistant, mailboxGuid, mailbox.DisplayName, this);
                    result = storeSession;
                }
                else
                {
                    bool           flag     = false;
                    MailboxSession mailbox2 = this.DatabaseInfo.GetMailbox(exchangePrincipal, ClientType.TimeBased, this.Assistant.GetType().Name);
                    try
                    {
                        mailbox2.ReconstructExchangePrincipal();
                        mailbox2.ExTimeZone = ExTimeZone.CurrentTimeZone;
                        flag = true;
                        AssistantsLog.LogMailboxSucceedToOpenStoreSessionEvent(activityId, nonLocalizedName, assistant, mailboxGuid, mailbox.DisplayName, this);
                        result = mailbox2;
                    }
                    finally
                    {
                        if (!flag)
                        {
                            mailbox2.Dispose();
                        }
                    }
                }
            }
            catch (ObjectNotFoundException ex)
            {
                string text    = "MailboxNotFound";
                string message = string.Format("{0}: {1}", this, text);
                string value   = string.Format("{0}:{1}", text, mailbox.MailboxGuid);
                ExTraceGlobals.TimeBasedDatabaseJobTracer.TraceError((long)this.GetHashCode(), message);
                AssistantsLog.LogMailboxFailedToOpenStoreSessionEvent(activityId, nonLocalizedName, assistant, ex, mailboxGuid, mailbox.DisplayName, this);
                throw new SkipException(new LocalizedString(value), ex);
            }
            catch (StorageTransientException ex2)
            {
                string message2 = string.Format("{0}: Could not open mailbox store session due to storage transient error: {1}", this, ex2.Message);
                ExTraceGlobals.TimeBasedDatabaseJobTracer.TraceError((long)this.GetHashCode(), message2);
                AssistantsLog.LogMailboxFailedToOpenStoreSessionEvent(activityId, nonLocalizedName, assistant, ex2, mailboxGuid, mailbox.DisplayName, this);
                Interlocked.Increment(ref this.mailboxesFailedToOpenStoreSessionCount);
                throw;
            }
            catch (Exception ex3)
            {
                string message3 = string.Format("{0}: Could not open mailbox store session due to error: {1}", this, ex3.Message);
                ExTraceGlobals.TimeBasedDatabaseJobTracer.TraceError((long)this.GetHashCode(), message3);
                AssistantsLog.LogMailboxFailedToOpenStoreSessionEvent(activityId, nonLocalizedName, assistant, ex3, mailboxGuid, mailbox.DisplayName, this);
                Interlocked.Increment(ref this.mailboxesFailedToOpenStoreSessionCount);
                throw;
            }
            return(result);
        }
Exemplo n.º 30
0
        protected override void InternalProcessRecord()
        {
            if (base.ExchangeRunspaceConfig == null)
            {
                base.WriteError(new MailboxSearchTaskException(Strings.UnableToDetermineExecutingUser), ErrorCategory.InvalidOperation, null);
                return;
            }
            if (base.DataObject == null)
            {
                if (this.e14SearchObject != null)
                {
                    if (this.e14SearchObject.SearchStatus != null)
                    {
                        if (!string.IsNullOrEmpty(this.e14SearchObject.SearchStatus.ResultsPath) && this.e14SearchObject.TargetMailbox != null)
                        {
                            ADUser aduser = (ADUser)this.recipientSession.Read(this.e14SearchObject.TargetMailbox);
                            if (aduser == null)
                            {
                                goto IL_357;
                            }
                            string serverFqdn = ExchangePrincipal.FromADUser(this.recipientSession.SessionSettings, aduser, RemotingOptions.AllowCrossSite).MailboxInfo.Location.ServerFqdn;
                            if (!string.IsNullOrEmpty(serverFqdn))
                            {
                                goto IL_357;
                            }
                            SearchId searchId = new SearchId(this.e14DataProvider.ADUser.Id.DistinguishedName, this.e14DataProvider.ADUser.Id.ObjectGuid, this.e14SearchObject.Id.Guid.ToString());
                            try
                            {
                                using (MailboxSearchClient client = new MailboxSearchClient(serverFqdn))
                                {
                                    Utils.RpcCallWithRetry(delegate()
                                    {
                                        client.Remove(searchId, true);
                                    });
                                }
                                goto IL_357;
                            }
                            catch (SearchServerException ex)
                            {
                                if (ex.ErrorCode == -2147220980)
                                {
                                    base.WriteError(new MailboxSearchIsInProgressException(this.e14SearchObject.Name), ErrorCategory.InvalidOperation, base.DataObject);
                                }
                                else
                                {
                                    base.WriteError(ex, ErrorCategory.InvalidOperation, null);
                                }
                                goto IL_357;
                            }
                            catch (RpcConnectionException ex2)
                            {
                                base.WriteError(new TaskException(Strings.MailboxSearchServiceUnavailable(serverFqdn, ex2.ErrorCode), ex2), ErrorCategory.InvalidOperation, null);
                                goto IL_357;
                            }
                            catch (RpcException ex3)
                            {
                                base.WriteError(new TaskException(Strings.MailboxSearchRpcCallFailed(serverFqdn, ex3.ErrorCode), ex3), ErrorCategory.InvalidOperation, null);
                                goto IL_357;
                            }
                        }
                        this.e14DataProvider.Delete(this.e14SearchObject.SearchStatus);
                    }
IL_357:
                    this.e14DataProvider.Delete(this.e14SearchObject);
                }
                return;
            }
            ComparisonFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.InPlaceHolds, base.DataObject.InPlaceHoldIdentity);

            ADRawEntry[] array = this.recipientSession.Find(null, QueryScope.SubTree, filter, null, 1);
            if (array != null && array.Length > 0)
            {
                base.WriteError(new TaskInvalidOperationException(Strings.ErrorCannotRemoveMailboxSearchWithMailboxOnHold(base.DataObject.Name)), ExchangeErrorCategory.Client, base.DataObject);
            }
            ExchangePrincipal exchangePrincipal = null;

            if (base.DataObject.Target != null)
            {
                try
                {
                    exchangePrincipal = ExchangePrincipal.FromLegacyDN(this.recipientSession.SessionSettings, base.DataObject.Target, RemotingOptions.AllowCrossSite);
                }
                catch (ObjectNotFoundException)
                {
                }
                if (exchangePrincipal == null)
                {
                    this.WriteWarning(Strings.ExceptionTargetMailboxNotFound(base.DataObject.Target, base.DataObject.Name));
                }
            }
            if (exchangePrincipal != null)
            {
                Utils.CheckSearchRunningStatus(base.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError), Strings.MailboxSearchIsInProgress(base.DataObject.Name));
                base.DataObject.UpdateState(SearchStateTransition.DeleteSearch);
                ((DiscoverySearchDataProvider)base.DataSession).CreateOrUpdate <MailboxDiscoverySearch>(base.DataObject);
                Utils.CreateMailboxDiscoverySearchRequest((DiscoverySearchDataProvider)base.DataSession, base.DataObject.Name, ActionRequestType.Delete, base.ExchangeRunspaceConfig.GetRbacContext().ToString());
                SearchEventLogger.Instance.LogDiscoverySearchRemoveRequestedEvent(base.DataObject, base.ExchangeRunspaceConfig.GetRbacContext().ToString());
                return;
            }
            base.InternalProcessRecord();
        }