我正在尝试从管理活动API获取Office 365审核日志。在为所需的内容类型创建订阅之后,我可以从订阅/内容API获取数据。
示例:-
查询:https://manage.office.com/api/v1.0/{tenant-id}/activity/feed/audit/xxxxx$xxxxx$audit_sharepoint$Audit_SharePoint
响应:
[
{
"CreationTime": "2018-10-08T10:13:15",
"Id": "xxxxx",
"Operation": "FileDownloaded",
"OrganizationId": "xxxxx",
"RecordType": 6,
"UserKey": "xxx|membership|xxxxxxx@live.com",
"UserType": 0,
"Version": 1,
"Workload": "OneDrive",
"ClientIP": "xx.xx.xx.xx",
"ObjectId": "xxxxxxx",
"UserId": "xxxxxx",
"ApplicationId": "xxxxxx",
"CorrelationId": "xxxxxx",
"EventSource": "SharePoint",
"ItemType": "File",
"ListId": "xxxxx",
"ListItemUniqueId": "xxxxx",
"Site": "xxxxx",
"UserAgent": "xxxxx",
"WebId": "xxxxx",
"SourceFileExtension": "jpg",
"SiteUrl": "xxxxx",
"SourceFileName": "xxxxx.jpg",
"SourceRelativeUrl": "xxxxx/xxxxx/xxxxx"
},
{..},{..}
]我需要获取特定用户执行的操作或对特定文件执行的操作的日志。这可以通过MSGraph安全和合规性中心的审核搜索来实现。
有没有办法让应用编程接口根据UserId或ObjectId字段(可能是查询参数)过滤其响应?
发布于 2018-10-08 23:24:23
遗憾的是,不支持通过AuditRecord 365管理活动UserId终结点按Office (内容blob) API或ObjectId属性进行筛选,仅支持以下参数:
contentTypestartTime和endTime解决方法是在客户端过滤结果,如下所示:
示例
const requestUrl = `https://manage.office.com/api/v1.0/${tenantId}/activity/feed/audit/${contentId}$audit_sharepoint$Audit_SharePoint`;
const options = {
method: 'GET',
headers: {
"Content-Type": "application/json; charset=utf-8",
"Authorization": "bearer " + accessToken
}
};
const rawResponse = await fetch(requestUrl,options);
const blobs = await rawResponse.json(); //get all blobs
const blobsByUser = blobs.filter(blob => {
return blob.UserId === "username@contoso.com";
})发布于 2022-01-22 17:43:32
遗憾的是,目前办公管理API尚不支持按对象ID过滤。这里记录了这一点-- https://docs.microsoft.com/en-us/office/office-365-management-api/troubleshooting-the-office-365-management-activity-api
请阅读以上文档中的“是否可以查询管理活动API”查询。
https://stackoverflow.com/questions/52700980
复制相似问题