Admin SDK Audit Service返回400 Bad请求

时间:2013-11-08 14:43:05

标签: c# asp.net google-admin-sdk

我正在使用Google Admin SDK,我正在尝试设置MailMonitor进行审核。这是我目前使用的代码

            MailMonitor monitor = new MailMonitor();
            monitor.BeginDate = new DateTime(2013, 11, 8);
            monitor.EndDate = new DateTime(2013, 12, 30);
            monitor.IncomingEmailMonitorLevel = MonitorLevel.FULL_MESSAGE;
            monitor.OutgoingEmailMonitorLevel = MonitorLevel.FULL_MESSAGE;
            monitor.DraftMonitorLevel = MonitorLevel.FULL_MESSAGE;
            monitor.ChatMonitorLevel = MonitorLevel.FULL_MESSAGE;
            monitor.DestinationUserName = "adminUser";

            AuditService service = new AuditService("domain.com", "domain.com-auditapp-v1");
            service.setUserCredentials("adminUser@domain.com", "password");

            MailMonitor monitorEntry = service.CreateMailMonitor("userToMonitor", monitor);

当我运行此代码时,我收到了400 Bad Request。我用于adminUser的凭据是正确的。我已经三次检查过了。我做错了什么?

1 个答案:

答案 0 :(得分:0)

我明白了。这是因为 BeginDate 变量需要处于当前(到第二个)的时间,或者在某个时刻。此时间也需要转换为UTC时间才能生效。