0

I'm using the Google Admin SDK and am trying to set up a MailMonitor for an audit. Here is the code I am currently using

            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);

When I run this code I get a 400 Bad Request returned. The credentials I'm using for the adminUser are correct. I've triple checked that. What am I doing wrong?

Ryan Duffing
  • 664
  • 3
  • 11
  • 20

1 Answers1

0

I figured it out. It was because the BeginDate variable needs to be at a time that's is exactly at the present (to the second), or at some point the future. This time also needs to be converted to UTC time in order for it to work.

Ryan Duffing
  • 664
  • 3
  • 11
  • 20