我目前正在尝试使用 GData .net API
我想要做的是使用 2 legged authentication 来做这个例子
using System;
using Google.GData.Apps;
using Google.GData.Extensions.Apps;
...
MailMonitor monitor = new MailMonitor();
monitor.BeginDate = new DateTime(2009, 6, 15);
monitor.EndDate = new DateTime(2009, 6, 30, 23, 20, 0);
monitor.IncomingEmailMonitorLevel = MonitorLevel.FULL_MESSAGE;
monitor.OutgoingEmailMonitorLevel = MonitorLevel.HEADER_ONLY;
monitor.DraftMonitorLevel = MonitorLevel.FULL_MESSAGE;
monitor.ChatMonitorLevel = MonitorLevel.FULL_MESSAGE;
monitor.DestinationUserName = "namrata";
AuditService service = new AuditService("example.com", "example.com-auditapp-v1");
service.setUserCredentials("admin@example.com", "p@55w0rd");
MailMonitor monitorEntry = service.CreateMailMonitor("abhishek", monitor);
我已经做到了
var monitor = new MailMonitor
{
EndDate = DateTime.Now.AddDays(1),
IncomingEmailMonitorLevel = MonitorLevel.FULL_MESSAGE,
OutgoingEmailMonitorLevel = MonitorLevel.HEADER_ONLY,
DraftMonitorLevel = MonitorLevel.FULL_MESSAGE,
ChatMonitorLevel = MonitorLevel.FULL_MESSAGE,
DestinationUserName = "MYUSER"
};
var service = new AuditService("MYDOMAIN", "MYDOMAIN-auditapp-v1");
var requestFactory = new GOAuthRequestFactory("auditapi", "MYDOMAIN-auditapp-v1")
{
ConsumerKey = "MYDOMAIN",
ConsumerSecret = "MYKEY"
};
service.RequestFactory = requestFactory;
var monitorEntry = service.CreateMailMonitor("MYUSER", monitor);
这是试图为一天内来往的任何电子邮件设置一个监视器。响应是未知的授权标头(错误 401)。
我从遵循本指南http://code.google.com/googleapps/domain/articles/2lo-in-tasks-for-admins.html获得了密钥
我不知道如何调试它,我找不到使用电子邮件审核 API 的 2 腿身份验证的示例,并且我无法使用wireshark,因为这是加密流量。