MailTraffic 报告

MailTraffic REST URI 提供有关发送到组织或从组织发出的邮件通信的摘要信息。报告的开始和结束日期/时间可以在请求中指定,正如可以指定聚合数据的时间段。

上次修改时间: 2015年9月17日

适用范围: Office 365

REST URI

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic[?ODATA options]

字段

下列字段可在 $select、$filter 和 $orderby ODATA2 查询选项中指定。如果没有提供 $select 选项,将返回所有字段。

名称

WCF 类型*

EDM 类型*

[In/Out]** 说明

示例值

在其中添加的服务版本

Action

字符串

未指定

[In/Out] 对邮件所采取操作的说明(如果有)。如果没有执行任何操作,此字段可能为空白或 null。有关有效操作值的信息,请参阅 MailFilterList 报告

SetSpamConfidenceLevel、RejectMessage

2013-V1

AggregateBy

string

未指定

[In] 指示是否将数据合并入涵盖全天的报告条目。$filter 值仅允许为 Day 和 Hour。如果未提供,则报告按 1 小时的期间聚合。$select 选项包含此字段时,此字段始终返回 null。请参阅"备注"部分,了解详细信息。

Day 或 Hour

2013-V1

Date

System.DateTime

Edm.DateTime

[In/Out] 邮件检测为垃圾邮件的日期和时间。

简写日期(例如,03/10/2013)或带引号的日期时间(例如,"03/10/2013 4:55 PM")

2013-V1

Direction

字符串

未指定

[In/Out] 指定电子邮件被检测为垃圾邮件时是发送到 (Inbound) 组织还是从组织发出 (Outbound)。

值限制为 Inbound 和 Outbound。

2013-V1

Domain

string

未指定

[In/Out] 处理电子邮件的完全限定的域名。

example.onmicrosoft.com

2013-V1

EndDate

System.DateTime

Edm.DateTime

[In] 此字段用于限制报告期间。在 $filter 查询选项中使用此字段设置报告期间的结束日期和时间。如果您在 $filter 选项中提供 EndDate,则还必须提供 StartDate。

简写日期(例如,03/10/2013)或带引号的日期时间(例如,"03/10/2013 4:55 PM")

2013-V1

EventType

string

未指定

[In/Out] 记录的扫描事件的类型。有关有效 EventType 值的信息,请参阅 MailFilterList 报告

SpamContentFiltered、SpamIPBlock

2013-V1

MessageCount

int

Edm.Int64

[In/Out] 聚合期间适合其他字段指定类别的邮件数量。

1254

2013-V1

Organization

string

未指定

[In/Out] 处理电子邮件的完全限定的域名。

example.onmicrosoft.com

2013-V1

StartDate

System.DateTime

Edm.DateTime

[In] 此字段用于限制报告期间。在 $filter 查询选项中使用此字段设置报告期间的开始日期和时间。如果您在 $filter 选项中提供 StartDate,则还必须指定 EndDate。

简写日期(例如,03/10/2013)或带引号的日期时间(例如,"03/10/2013 4:55 PM")

2013-V1

SummarizeBy

string

未指定

[In] 使用此字段的 $filter 选项中指定的报告字段确定了报告条目合并形成摘要的方式。请参阅"备注"部分,了解详细信息。$select 选项中包含此字段时,此字段始终返回 null。

Action、EventType、Domain 和 Direction 是带此字段的 $filter 选项中仅允许使用的值。

2013-V1

*WCF 类型指在 Visual Studio 中创建 Windows Communication Foundation (WCF) 服务参考时分配给字段的 .NET Framework 数据类型。EDM 类型指 Atom 格式化报告中返回的 ADO.NET 实体数据模型 (EDM) 类型。

**有关 [In/Out] 指示符的信息,请参阅"输入参数和报告输出列" 部分。

备注

报告中的每个条目都包括元数据的多个字段。有关详细信息,请参阅 Office 365 报告 Web 服务返回的常见元数据

Date 字段指示邮件由 Office 365 系统处理的时间,并按那些服务器所在的时区报告时间。

使用 StartDate 和 EndDate

StartDate 和 EndDate 字段不在报告结果中提供有用的信息,且在报告输出中始终设置为 0001-01-01T00:00:00Z。它们旨在便于限制报告时间段,且提供比"每日"报告更为精确的精度。

这在每小时记录一次基于电子邮件的拒绝服务攻击等情况下尤其有用。使用这些字段时,必须在 $filter 选项中包含两者。它们都被视为可选,但如果您提供一个,则需要提供另一个。如果查询中没有提供 StartDate/EndDate 对,则默认报告时间段是过去两周。本主题下文的"示例"部分显示如何使用 StartDate 和 EndDate 字段。

使用 AggregateBy 字段

MailTraffic 报告返回 Office 365 系统中电子邮件相关事件的摘要。每个事件记录了其 Action、Event、Date、Sender 等。Office 365 记录的数据包括每个事件的确切日期和时间。"详细信息"报告(如 MailDetailMalware)提供特定事件及其确切时间的列表。"通信量"报告(如 MailTraffic)汇总并提供两种持续时间内这些事件的计数:小时和天。您可以在 $filter 查询选项中指定使用哪种时间方式,如以下示例所示。如果 $filter 选项中不包含任何 AggregateBy 比较,则使用默认的 Hour。

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic?$filter=AggregateBy eq 'Day'

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic?$filter=AggregateBy eq 'Hour'

使用 SummarizeBy 字段

通过 SummarizeBy 字段,您可以"折叠"指定字段名称的报告输出。例如,假设在为期一天的报告期中,有 200 个入站邮件和 100 个出站邮件。如果查询包含 $filter=AggregateBy eq ‘Day’,则报告会返回当天的两个单独条目:一个针对入站邮件,显示 MessageCount 为 200 且 Direction 为 Inbound,另一个条目针对出站邮件,显示 MessageCount 为 100 且 Direction 为 Outbound。如果您还在 $filter 选项中提供了 SummarizeBy 字段,如 SummarizeBy eq ‘Direction’ 中所示,则报告仅会包含当天的一个条目,Direction 字段为空且 MessageCount 为 300。Direction 字段为空是因为条目将 Direction eq ‘Inbound’ 邮件计数和 Direction eq ‘Outbound’ 邮件计数一起汇总。

仅支持以下字段与 SummarizeBy 一起使用。

  • Action

  • EventType

  • Direction

  • Domain

您的请求可包含要汇总的多个允许字段,如以下 $filter 选项所示。

$filter=SummarizeBy eq 'EventType,Action'

如果请求在一个字段上使用 SummarizeBy,而且 $select 选项中也包含该字段名称,则该字段将始终报告为空值。

以下请求显示如何请求电子邮件流量的每日摘要,仅返回 Date、Direction 和 MessageCount 字段。结果将按天聚合。为清楚起见,请求中添加了换行符。

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic?
$select=Date,Direction,MessageCount&
$filter=AggregateBy%20eq%20'Day'&
$format=Atom

下面显示请求的结果。为简化结果,已删除大部分元数据元素。请注意,有两个条目,一个条目的 Direction 为 Inbound,同一天的另一个条目的 Direction 为 Outbound。

<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/">
  <id>https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic</id>
  <title type="text">MailTraffic</title>
  <entry>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-29T00:00:00</d:Date>
        <d:Direction>Inbound</d:Direction>
        <d:MessageCount m:type="Edm.Int32">7</d:MessageCount>
      </m:properties>
    </content>
  </entry>
  <entry>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-29T00:00:00</d:Date>
        <d:Direction>Outbound</d:Direction>
        <d:MessageCount m:type="Edm.Int32">58</d:MessageCount>
      </m:properties>
    </content>
  </entry>
 </feed>

如果您除了通过 Direction 汇总之外还进行了相同的请求,请求将变成如下所示。

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic?
$select=Date,Direction,MessageCount&
$filter=AggregateBy%20eq%20'Day'%20and%20SummarizeBy%20eq%20'Direction'&
$format=Atom

此同一天的响应会折叠或汇总Direction 字段。换言之,它将合并仅与 Direction 字段值不同的所有字段的计数。Direction 元素返回为空,指示报告条目合并事件的计数,忽略 Direction 值的差异。

<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/">
  <id>https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic</id>
  <title type="text">MailTraffic</title>
  <entry>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-29T00:00:00</d:Date>
        <d:Direction>
        </d:Direction>
        <d:MessageCount m:type="Edm.Int32">65</d:MessageCount>
      </m:properties>
    </content>
  </entry>
 </feed>

示例

以下示例介绍了如何检索 2013 年 1 月第一周组织每日入站邮件汇总(采用基于 XML 的 Atom 格式)。对于此报告,使用了 SummarizeBy EventType,因此所有邮件处置的输出为单报告条目。为清楚起见,请求和响应中添加了换行符。

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic?
$select=MessageCount,%20Date&
$filter=Direction%20eq%20'Inbound'%20and%20AggregateBy%20eq%20'Day'%20and%20
  StartDate%20eq%20datetime'2013-01-01T00:00:00Z'%20and%20
  EndDate%20eq%20datetime'2013-01-08T00:00:00Z'%20and%20
  SummarizeBy%20eq%20'EventType'&
$format=Atom
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/" 
  xmlns="http://www.w3.org/2005/Atom" 
  xmlns:d="https://schemas.microsoft.com/ado/2007/08/dataservices"
  xmlns:m="https://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <id>https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailTraffic</id>
  <title type="text">MailTraffic</title>
  <updated>2013-02-09T02:02:16Z</updated>
  <link rel="self" title="MailTraffic" href="MailTraffic" />
  <entry>
    <id>https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(0)</id>
    <category term="TenantReporting.MailTrafficReport" 
      scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="MailTrafficReport" href="MailTraffic(0)" />
    <title />
    <updated>2013-02-09T02:02:16Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-01T00:00:00</d:Date>
        <d:MessageCount m:type="Edm.Int32">100</d:MessageCount>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(1)</id>
    <category term="TenantReporting.MailTrafficReport" 
      scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="MailTrafficReport" href="MailTraffic(1)" />
    <title />
    <updated>2013-02-09T02:02:16Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-02T00:00:00</d:Date>
        <d:MessageCount m:type="Edm.Int32">150</d:MessageCount>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(2)</id>
    <category term="TenantReporting.MailTrafficReport" 
      scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="MailTrafficReport" href="MailTraffic(2)" />
    <title />
    <updated>2013-02-09T02:02:16Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-03T00:00:00</d:Date>
        <d:MessageCount m:type="Edm.Int32">158</d:MessageCount>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(3)</id>
    <category term="TenantReporting.MailTrafficReport" 
      scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="MailTrafficReport" href="MailTraffic(3)" />
    <title />
    <updated>2013-02-09T02:02:16Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-04T00:00:00</d:Date>
        <d:MessageCount m:type="Edm.Int32">178</d:MessageCount>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(4)</id>
    <category term="TenantReporting.MailTrafficReport" 
      scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="MailTrafficReport" href="MailTraffic(4)" />
    <title />
    <updated>2013-02-09T02:02:16Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-05T00:00:00</d:Date>
        <d:MessageCount m:type="Edm.Int32">116</d:MessageCount>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(5)</id>
    <category term="TenantReporting.MailTrafficReport" 
      scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="MailTrafficReport" href="MailTraffic(5)" />
    <title />
    <updated>2013-02-09T02:02:16Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-06T00:00:00</d:Date>
        <d:MessageCount m:type="Edm.Int32">108</d:MessageCount>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(5)</id>
    <category term="TenantReporting.MailTrafficReport" 
      scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="MailTrafficReport" href="MailTraffic(5)" />
    <title />
    <updated>2013-02-09T02:02:16Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:Date m:type="Edm.DateTime">2013-01-07T00:00:00</d:Date>
        <d:MessageCount m:type="Edm.Int32">45</d:MessageCount>
      </m:properties>
    </content>
  </entry>
</feed>

下面以 JSON 格式显示相同的报告结果。

  {
    "d":
      {
        "results":
          [
              {
                "__metadata":
                  {
                    "id":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(0)",
                    "uri":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(0)",
                    "type":"TenantReporting.MailTrafficReport"
                  },
                "Date":"\/Date(1356998400000)\/",
                "MessageCount":100
              },
              {
                "__metadata":
                  {
                    "id":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(1)",
                    "uri":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(1)",
                    "type":"TenantReporting.MailTrafficReport"
                  },
                "Date":"\/Date(1357084800000)\/",
                "MessageCount":150
              },
              {
                "__metadata":
                  {
                    "id":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(2)",
                    "uri":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(2)",
                    "type":"TenantReporting.MailTrafficReport"
                  },
                "Date":"\/Date(1357171200000)\/",
                "MessageCount":158
              },
              {
                "__metadata":
                  {
                    "id":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(3)",
                    "uri":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(3)",
                    "type":"TenantReporting.MailTrafficReport"
                  },
                "Date":"\/Date(1357257600000)\/",
                "MessageCount":178
              },
              {
                "__metadata":
                  {
                    "id":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(4)",
                    "uri":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(4)",
                    "type":"TenantReporting.MailTrafficReport"
                  },
                "Date":"\/Date(1357344000000)\/",
                "MessageCount":116
              },
              {
                "__metadata":
                  {
                    "id":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(5)",
                    "uri":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(5)",
                    "type":"TenantReporting.MailTrafficReport"
                  },
                "Date":"\/Date(1357430400000)\/",
                "MessageCount":108
              },
              {
                "__metadata":
                  {
                    "id":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(6)",
                    "uri":"https://reports.office365.com/ecp/ReportingWebService/Reporting.svc/MailTraffic(6)",
                    "type":"TenantReporting.MailTrafficReport"
                  },
                "Date":"\/Date(135751680000)\/",
                "MessageCount":45
              }
          ]
      }
  }

输入参数和报告输出列

字段表格中的 [In/Out] 指示符具有以下含义:

  • 字段表中标记为 [In] 的字段主要在 $filter=、$orderby= 和其他限制报告应返回哪些条目的查询选项中使用。字段表中标记为 [In] 的字段可包含在 $select= 选项中,它们将在报告条目中出现,但不包含有用数据。

  • 字段表中标记为 [In/Out] 的字段可在列选择 ($select=) 和条目限制($filter= 和 $orderby=)选项中使用。当您在 $select= 选项中包含这些字段之一时,它们将在报告条目中出现,且将在提供时包含有用数据。

兼容性

Office 365 服务版本 2013-V1 中引入了 MailTraffic 报告。有关版本控制的详细信息,请参阅 Office 365 报告 Web 服务中的版本控制

相应的 Windows PowerShell cmdlet

MailTraffic 报告返回与 Get-MailTrafficReport Windows PowerShell cmdlet 相同的信息。

权限

您用于访问报告的帐户必须拥有该 Office 365 组织的管理权限。如果此帐户可以在 Office 365 控制面板中查看此报告,则此帐户具有从 REST Web 服务检索数据的权限。此报告要求为用户分配收件人(仅查看)角色。在默认的 Office 365 权限结构中,具有下列管理员权限的用户可以访问此报告:帐务管理员 、全局管理员、密码管理员、服务管理员和用户管理管理员。有关详细信息,请参阅MailboxUsage 报告

数据粒度、持久性和可用性

此报告提供的信息存储了每个事件的确切日期和时间。您可以通过在 $filter 选项中包含 StartDate 和 EndDate 字段来使用任何可行的时间段和持续时间。时间按服务器扫描电子邮件的时区报告。此报告按小时或天数计算邮件的计数,具体取决于 AggregateBy 字段。

此报告的信息适用于 14 天的时间段,或者直到取消订阅为止。

事件可能被推迟达 24 小时,然后才能显示在报告中。