public override void Save(IConfigurable instance) { MailboxAuditLogSearch mailboxAuditLogSearch = (MailboxAuditLogSearch)instance; MailboxAuditLogSearch mailboxAuditLogSearch2 = new MailboxAuditLogSearch(); mailboxAuditLogSearch2.Identity = (AuditLogSearchId)mailboxAuditLogSearch.Identity; mailboxAuditLogSearch2.Name = mailboxAuditLogSearch.Name; mailboxAuditLogSearch2.StartDateUtc = new DateTime?(mailboxAuditLogSearch.StartDateUtc.Value); mailboxAuditLogSearch2.EndDateUtc = new DateTime?(mailboxAuditLogSearch.EndDateUtc.Value); mailboxAuditLogSearch2.StatusMailRecipients = NewAuditLogSearchBase <MailboxAuditLogSearch> .GetMultiValuedSmptAddressAsStrings(mailboxAuditLogSearch.StatusMailRecipients); mailboxAuditLogSearch2.CreatedBy = mailboxAuditLogSearch.CreatedBy; mailboxAuditLogSearch2.CreatedByEx = mailboxAuditLogSearch.CreatedByEx; mailboxAuditLogSearch2.Mailboxes = mailboxAuditLogSearch.Mailboxes; mailboxAuditLogSearch2.LogonTypes = mailboxAuditLogSearch.LogonTypes; mailboxAuditLogSearch2.Operations = mailboxAuditLogSearch.Operations; mailboxAuditLogSearch2.ShowDetails = new bool?(mailboxAuditLogSearch.ShowDetails); if (mailboxAuditLogSearch.ExternalAccess != null) { mailboxAuditLogSearch2.ExternalAccess = (mailboxAuditLogSearch.ExternalAccess.Value ? bool.TrueString : bool.FalseString); } base.Save(mailboxAuditLogSearch2); AuditQueuesOpticsLogData auditQueuesOpticsLogData = new AuditQueuesOpticsLogData { QueueType = AuditQueueType.AsyncMailboxSearch, EventType = QueueEventType.Queue, CorrelationId = mailboxAuditLogSearch2.Identity.Guid.ToString(), OrganizationId = this.organizationId, QueueLength = ((this.defaultFolder != null) ? (this.defaultFolder.TotalCount + 1) : 1) }; auditQueuesOpticsLogData.Log(); instance.ResetChangeTracking(); }
protected override void SaveObjectToStore(AuditLogSearchBase searchBase) { MailboxAuditLogSearch mailboxAuditLogSearch = (MailboxAuditLogSearch)searchBase; using (MailboxAuditLogSearchItem mailboxAuditLogSearchItem = new MailboxAuditLogSearchItem(base.MailboxSession, base.Folder)) { Guid guid = ((AuditLogSearchId)mailboxAuditLogSearch.Identity).Guid; mailboxAuditLogSearchItem.Identity = guid; mailboxAuditLogSearchItem.Name = mailboxAuditLogSearch.Name; mailboxAuditLogSearchItem.StartDate = new ExDateTime(ExTimeZone.UtcTimeZone, mailboxAuditLogSearch.StartDateUtc.Value); mailboxAuditLogSearchItem.EndDate = new ExDateTime(ExTimeZone.UtcTimeZone, mailboxAuditLogSearch.EndDateUtc.Value); mailboxAuditLogSearchItem.StatusMailRecipients = mailboxAuditLogSearch.StatusMailRecipients; mailboxAuditLogSearchItem.CreatedBy = mailboxAuditLogSearch.CreatedBy; mailboxAuditLogSearchItem.CreatedByEx = mailboxAuditLogSearch.CreatedByEx; mailboxAuditLogSearchItem.MailboxIds = mailboxAuditLogSearch.Mailboxes; mailboxAuditLogSearchItem.LogonTypeStrings = mailboxAuditLogSearch.LogonTypes; mailboxAuditLogSearchItem.Operations = mailboxAuditLogSearch.Operations; mailboxAuditLogSearchItem.ShowDetails = mailboxAuditLogSearch.ShowDetails; mailboxAuditLogSearchItem.ExternalAccess = mailboxAuditLogSearch.ExternalAccess; mailboxAuditLogSearchItem.Save(SaveMode.ResolveConflicts); AuditQueuesOpticsLogData auditQueuesOpticsLogData = new AuditQueuesOpticsLogData { QueueType = AuditQueueType.AsyncMailboxSearch, EventType = QueueEventType.Queue, CorrelationId = guid.ToString(), OrganizationId = base.MailboxSession.OrganizationId, QueueLength = base.Folder.ItemCount + 1 }; auditQueuesOpticsLogData.Log(); } }
internal override void Initialize(AuditLogSearchBase item) { MailboxAuditLogSearch mailboxAuditLogSearch = (MailboxAuditLogSearch)item; base.Initialize(item); this.Mailboxes = mailboxAuditLogSearch.Mailboxes; this.LogonTypes = mailboxAuditLogSearch.LogonTypes; this.Operations = mailboxAuditLogSearch.Operations; this.ShowDetails = (mailboxAuditLogSearch.ShowDetails ?? false); }
public MailboxAuditLogSearchWorker(int searchTimeoutSeconds, MailboxAuditLogSearch searchCriteria, Unlimited <int> resultSize, AuditLogOpticsLogData searchStatistics) { if (searchTimeoutSeconds <= 0) { throw new ArgumentOutOfRangeException("searchTimeoutSeconds"); } if (searchCriteria == null) { throw new ArgumentNullException("searchCriteria"); } this.searchCriteria = searchCriteria; this.searchStatistics = searchStatistics; if (MailboxAuditLogSearchWorker.UseFASTQuery(this.searchCriteria)) { this.queryString = this.GenerateFASTSearchQueryString(); } else { this.queryFilter = this.GenerateSearchQueryFilter(); } this.searchTimeoutSeconds = searchTimeoutSeconds; this.resultSize = resultSize; this.recipientSessionInternal = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(searchCriteria.OrganizationId), 163, ".ctor", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxAuditLog\\MailboxAuditLogSearchWorker.cs"); }
public override IConfigurable Read <T>(ObjectId identity) { AuditLogSearchId auditLogSearchId = identity as AuditLogSearchId; if (auditLogSearchId != null) { SearchFilter filter = new SearchFilter.IsEqualTo(AuditLogSearchBaseEwsSchema.Identity.StorePropertyDefinition, auditLogSearchId.Guid.ToString()); using (IEnumerator <MailboxAuditLogSearch> enumerator = this.FindInFolder <MailboxAuditLogSearch>(filter, this.GetDefaultFolder()).GetEnumerator()) { if (enumerator.MoveNext()) { MailboxAuditLogSearch mailboxAuditLogSearch = enumerator.Current; MailboxAuditLogSearch mailboxAuditLogSearch2 = new MailboxAuditLogSearch(); mailboxAuditLogSearch2.SetId(mailboxAuditLogSearch.Identity); mailboxAuditLogSearch2.Name = mailboxAuditLogSearch.Name; mailboxAuditLogSearch2.StartDateUtc = new DateTime?(mailboxAuditLogSearch.StartDateUtc.Value); mailboxAuditLogSearch2.EndDateUtc = new DateTime?(mailboxAuditLogSearch.EndDateUtc.Value); mailboxAuditLogSearch2.StatusMailRecipients = NewAuditLogSearchBase <MailboxAuditLogSearch> .GetMultiValuedStringsAsSmptAddresses(mailboxAuditLogSearch.StatusMailRecipients); mailboxAuditLogSearch2.CreatedBy = mailboxAuditLogSearch.CreatedBy; mailboxAuditLogSearch2.CreatedByEx = mailboxAuditLogSearch.CreatedByEx; mailboxAuditLogSearch2.Mailboxes = mailboxAuditLogSearch.Mailboxes; mailboxAuditLogSearch2.LogonTypes = mailboxAuditLogSearch.LogonTypes; mailboxAuditLogSearch2.Operations = mailboxAuditLogSearch.Operations; mailboxAuditLogSearch2.ShowDetails = (mailboxAuditLogSearch.ShowDetails != null && mailboxAuditLogSearch.ShowDetails.Value); bool value; if (!string.IsNullOrEmpty(mailboxAuditLogSearch.ExternalAccess) && bool.TryParse(mailboxAuditLogSearch.ExternalAccess, out value)) { mailboxAuditLogSearch2.ExternalAccess = new bool?(value); } return(mailboxAuditLogSearch2); } } } return(null); }
protected override void InternalValidate() { base.InternalValidate(); this.resultCount = 0; if (this.StartDate == null && this.EndDate == null) { this.EndDate = new ExDateTime?(ExDateTime.Now); this.StartDate = new ExDateTime?(this.EndDate.Value.AddDays(-15.0)); } if (this.StartDate != null && this.EndDate == null) { this.EndDate = new ExDateTime?(this.StartDate.Value.AddDays(15.0)); } if (this.StartDate == null && this.EndDate != null) { this.StartDate = new ExDateTime?(this.EndDate.Value.AddDays(-15.0)); } if (this.StartDate.Value > this.EndDate.Value) { base.WriteError(new ArgumentException(Strings.ErrorMailboxAuditLogSearchStartDateIsLaterThanEndDate(this.StartDate.Value.ToString(), this.EndDate.Value.ToString())), ErrorCategory.InvalidArgument, null); } if (base.Fields["ResultSize"] == null) { this.ResultSize = 10000; } this.searchCriteria = new MailboxAuditLogSearch { OrganizationId = base.CurrentOrganizationId, LogonTypesUserInput = this.LogonTypes, OperationsUserInput = this.Operations, ShowDetails = this.ShowDetails.ToBool(), ExternalAccess = this.ExternalAccess }; if (!this.StartDate.Value.HasTimeZone) { ExDateTime exDateTime = ExDateTime.Create(ExTimeZone.CurrentTimeZone, this.StartDate.Value.UniversalTime)[0]; this.searchCriteria.StartDateUtc = new DateTime?(exDateTime.UniversalTime); } else { this.searchCriteria.StartDateUtc = new DateTime?(this.StartDate.Value.UniversalTime); } if (!this.EndDate.Value.HasTimeZone) { ExDateTime exDateTime2 = ExDateTime.Create(ExTimeZone.CurrentTimeZone, this.EndDate.Value.UniversalTime)[0]; this.searchCriteria.EndDateUtc = new DateTime?(exDateTime2.UniversalTime); } else { this.searchCriteria.EndDateUtc = new DateTime?(this.EndDate.Value.UniversalTime); } this.searchCriteria.Mailboxes = MailboxAuditLogSearch.ConvertTo((IRecipientSession)base.DataSession, this.Mailboxes, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), new Task.TaskErrorLoggingDelegate(base.WriteError)); this.searchCriteria.Validate(new Task.TaskErrorLoggingDelegate(base.WriteError)); this.searchStatistics = new AuditLogOpticsLogData(); this.searchStatistics.OrganizationId = this.searchCriteria.OrganizationId; this.searchStatistics.SearchType = "Mailbox"; this.searchStatistics.CallResult = false; this.searchStatistics.QueryComplexity = this.searchCriteria.QueryComplexity; this.searchStatistics.IsAsynchronous = false; this.searchStatistics.ShowDetails = this.searchCriteria.ShowDetails; this.searchStatistics.SearchStartDateTime = this.searchCriteria.StartDateUtc; this.searchStatistics.SearchEndDateTime = this.searchCriteria.EndDateUtc; this.worker = new MailboxAuditLogSearchWorker(600, this.searchCriteria, this.ResultSize, this.searchStatistics); }
private static bool UseFASTQuery(MailboxAuditLogSearch searchCriteria) { return((searchCriteria.LogonTypes != null && searchCriteria.LogonTypes.Count > 0) || searchCriteria.ExternalAccess != null); }