public static List <POCO.O365.AuditLogEntryv1> GetAuditEventsv1(DataConfig providerConfig, string tableName, List <DataFactory.Filter> filters, string thisPageId, int rowLimit, out string nextPageId) { List <POCO.O365.AuditLogEntryv1> auditEntries = new List <POCO.O365.AuditLogEntryv1>(); // Default next page id to "no more data" (empty string) nextPageId = string.Empty; switch (providerConfig.ProviderType) { case "azure.tableservice": // Prefix with stlp tableName = "stlp" + tableName; string combinedFilter = Utils.GenerateAzureFilter(filters); TableContinuationToken thisPageToken = null; if (thisPageId != null && thisPageId != string.Empty) { thisPageToken = Newtonsoft.Json.JsonConvert.DeserializeObject <TableContinuationToken>(thisPageId); } TableContinuationToken nextPageToken = null; List <AzureAuditLogEntryv1> azdata = new List <AzureAuditLogEntryv1>(); AzureTableAdaptor <AzureAuditLogEntryv1> adaptor = new AzureTableAdaptor <AzureAuditLogEntryv1>(); azdata = adaptor.ReadTableDataWithToken(providerConfig, tableName, combinedFilter, rowLimit, thisPageToken, out nextPageToken); foreach (var doc in azdata) { auditEntries.Add(doc.Value); } // Check if there is a next page token available if (nextPageToken != null) { nextPageId = Newtonsoft.Json.JsonConvert.SerializeObject(nextPageToken); } break; case "internal.mongodb": var collection = Utils.GetMongoCollection <MongoAuditLogEntryv1>(providerConfig, tableName); // Add an _id filter if a page has been requested if (thisPageId != null && thisPageId != string.Empty) { filters.Insert(0, new Filter("_id", thisPageId, "gt")); } FilterDefinition <MongoAuditLogEntryv1> filter = Utils.GenerateMongoFilter <MongoAuditLogEntryv1>(filters); var documents = collection.Find(filter).Sort("{\"_id\":1}").Limit(rowLimit).ToList(); foreach (var logentry in documents) { auditEntries.Add(logentry); } break; default: throw new ApplicationException("Data provider not recognised: " + providerConfig.ProviderType); } return(auditEntries); }