コード例 #1
0
 public EwsAuditLog(EwsAuditClient ewsClient, FolderIdType auditFolderId, DateTime logRangeStart, DateTime logRangeEnd)
 {
     this.ewsClient             = ewsClient;
     this.auditFolderId         = auditFolderId;
     this.EstimatedLogStartTime = logRangeStart;
     this.EstimatedLogEndTime   = logRangeEnd;
 }
コード例 #2
0
        private IAuditLog GetAuditLog(string organizationIdEncoded, AuditRecord auditRecord)
        {
            CacheEntry <IAuditLog> cacheEntry;
            IAuditLog         auditLog          = this.auditLogs.TryGetValue(organizationIdEncoded, DateTime.UtcNow, out cacheEntry) ? cacheEntry.Value : null;
            ExchangePrincipal exchangePrincipal = this.GetExchangePrincipal(organizationIdEncoded);
            EwsAuditClient    ewsClient         = null;
            FolderIdType      folderIdType      = null;

            if (AuditFeatureManager.IsPartitionedAdminLogEnabled(exchangePrincipal) && (auditLog == null || auditLog.EstimatedLogEndTime < auditRecord.CreationTime))
            {
                this.GetClientAndRootFolderId(exchangePrincipal, ref ewsClient, ref folderIdType);
                EwsAuditLogCollection ewsAuditLogCollection = new EwsAuditLogCollection(ewsClient, folderIdType);
                if (ewsAuditLogCollection.FindLog(auditRecord.CreationTime, true, out auditLog))
                {
                    this.auditLogs.Set(organizationIdEncoded, DateTime.UtcNow, new CacheEntry <IAuditLog>(auditLog));
                }
                else
                {
                    auditLog = null;
                }
            }
            if (auditLog == null)
            {
                this.GetClientAndRootFolderId(exchangePrincipal, ref ewsClient, ref folderIdType);
                auditLog = new EwsAuditLog(ewsClient, folderIdType, DateTime.MinValue, DateTime.MaxValue);
                this.auditLogs.Set(organizationIdEncoded, DateTime.UtcNow, new CacheEntry <IAuditLog>(auditLog));
            }
            return(auditLog);
        }
コード例 #3
0
        private static FolderIdType GetAuditRootFolderId(EwsAuditClient ewsClient)
        {
            FolderIdType folderIdType;

            ewsClient.CheckAndCreateWellKnownFolder(DistinguishedFolderIdNameType.root, DistinguishedFolderIdNameType.recoverableitemsroot, out folderIdType);
            FolderIdType result;

            ewsClient.CheckAndCreateWellKnownFolder(DistinguishedFolderIdNameType.recoverableitemsroot, DistinguishedFolderIdNameType.adminauditlogs, out result);
            return(result);
        }
コード例 #4
0
 public EwsAuditLogCollection(EwsAuditClient ewsClient, FolderIdType auditRootFolderId)
 {
     this.ewsClient         = ewsClient;
     this.auditRootFolderId = auditRootFolderId;
 }
コード例 #5
0
 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));
 }