我正在尝试在O365中记录消息传递/失败信息。我有超过25万个邮箱,而我尝试跟踪的消息是发送到具有大量嵌套DL的根DL的全局电子邮件。 我正在尝试以下内容。
$Root = "https://reports.office365.com/ecp/reportingwebservice/reporting.svc/"
$Format = "`$format=JSON"
$WebService = "MessageTrace"
$Select = "`$select=RecipientAddress,Status"
$Filter = "`$filter=MessageId eq 'xxxxxxxxxxxxxxxxxxx@xxxx.xxx.xxxx.OUTLOOK.COM' and Status eq 'Failed'"
# Build report URL
$url = ($Root + $WebService + "/?" + $Select + "&" + $Filter + "&" + $Format)
$sens = $null
Do {
$sens = Invoke-RestMethod -Credential $cred -uri $url
$sens.d.results.Count
$sens.d.results | select -Last 1 -ExpandProperty RecipientAddress| ft -Wrap
if ($sens.d.__next) {
$url = ($sens.d.__next + "&" + $Format)
}
} While ($sens.d.__next -ne $null)
对于我的测试域中的示例邮件跟踪,我应该具有:
我遇到了PageSize
的问题,因为默认限制为2000
。首次交付完成时,使用交付和扩展进行过滤可以为我提供准确的结果。
但是失败事件(必须分为3页)不能正确获取数据。
如果我的理解是正确的,我应该看到2个迭代,每个迭代有2000个条目,并且__next
分别包含$skiptoken=1999
和3999
,最后一个迭代有1001个条目,没有{{1} },但是即使经过第三次迭代,我仍然得到__next
,并且__next
不断增加超过10000秒。
似乎循环得到相同的结果。
$skiptoken
我可以看到结果条目在第1次,第2次和第3次迭代之间也不是唯一的。似乎每次尝试都会随机抽取2000个条目。
我尝试对2000
sens2500@contoso.local
2000
sens939@contoso.local
2000
sens1183@contoso.local
2000
sens214@contoso.local
2000
sens1183@contoso.local
2000
sens1423@contoso.local
做一个[IN]
,看是否有什么不同,但我无法使其成功运行。
对此有任何帮助吗?