我正在使用 Microsoft 的 o365 REST API 客户端库 ( https://github.com/Microsoft/o365rwsclient ) 并且已经能够使许多 API 调用正常工作,但我对“SPOOneDriveForBusinessFileActivity”没有任何运气。另外,我没有看到它在https://reports.office365.com/ecp/reportingwebservice/reporting.svc的 o365 Web 服务原子提要中做广告
以下是事件应返回的描述:https: //support.office.com/en-gb/article/Understanding-the-User-activity-logs-report-80d0b3b1-1ee3-4777-8c68-6c0dedf1f980
查看https://github.com/Microsoft/o365rwsclient/blob/master/TenantReport/SPOOneDriveForBusinessFileActivity.cs中的源代码,它似乎是一个有效的函数,但是当从 ac# 应用程序(下)使用 o365rwsclient 库时,我得到了404 错误(未找到 URL)。
有什么想法吗?此报告是否已实施(Powershell cmdlet 或直接 REST 调用也可以接受)- 如果是,我如何访问它?
using Microsoft.Office365.ReportingWebServiceClient;
using System;
namespace O365ReportingDataExport
{
internal class Program
{
private static void Main(string[] args)
{
ReportingContext context = new ReportingContext();
//If you enter invalid authentication information, Visual Studio will throw an exception.
context.UserName = @"PUT YOUR OFFICE 365 USER EMAIL ADDRESS HERE";
context.Password = @"PUT YOUR OFFICE 365 USER PASSWORD HERE";
//FromDateTime & ToDateTime are optional, default value is DateTime.MinValue if not specified
context.FromDateTime = DateTime.MinValue;
context.ToDateTime = DateTime.MinValue;
context.SetLogger(new CustomConsoleLogger());
IReportVisitor visitor = new CustomConsoleReportVisitor();
ReportingStream stream1 = new ReportingStream(context, "SPOOneDriveForBusinessFileActivity", "stream1");
//Calls VisitReport
stream1.RetrieveData(visitor);
Console.WriteLine("Press Any Key...");
Console.ReadKey();
}
private class CustomConsoleLogger : ITraceLogger
{
public void LogError(string message)
{
Console.WriteLine(message);
}
public void LogInformation(string message)
{
Console.WriteLine(message);
}
}
private class CustomConsoleReportVisitor : IReportVisitor
{
public override void VisitBatchReport()
{
foreach (ReportObject report in this.reportObjectList)
{
VisitReport(report);
}
}
public override void VisitReport(ReportObject record)
{
Console.WriteLine("Record: " + record.Date.ToString());
}
}
}
}