question

trungpn17 avatar image
0 Votes"
trungpn17 asked trungpn17 answered

Unable to download message trace via rest api

Hi all,
I am using code from this link https://github.com/microsoft/o365rwsclient to get message trace log from Office365. Everything was working fine until the last 2 weeks, I always get the error

One or more errors occurred.: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Microsoft.Office365.ReportingWebServiceClient.ReportProvider.GetAsyncResult[T](Task`1 asyncFunction) in D:\LapTrinh\LogOffice365\ToolLogO365\o365rwsclient-master\ReportProvider.cs:line 48 at Microsoft.Office365.ReportingWebServiceClient.ReportProvider.GetResponseContent(String serviceFullUrl) in D:\LapTrinh\LogOffice365\ToolLogO365\o365rwsclient-master\ReportProvider.cs:line 111 One or more errors occurred.: at Microsoft.Office365.ReportingWebServiceClient.ReportProvider.GetResponseContent(String serviceFullUrl) in D:\LapTrinh\LogOffice365\ToolLogO365\o365rwsclient-master\ReportProvider.cs:line 132 at Microsoft.Office365.ReportingWebServiceClient.ReportProvider.GetResponseXml(Type reportType, QueryFilter filter) in D:\LapTrinh\LogOffice365\ToolLogO365\o365rwsclient-master\ReportProvider.cs:line 159

Specifically, the code still runs normally for 2-3 minutes, then it will fail and send the error message as above.

My command line example is https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTrace?$top=2000&$skiptoken=2000&$filter=(StartDate eq datetime'2021-10-01T00: 57:35') and (EndDate eq datetime'2021-10-01T01:01:11')

Can you help me?

microsoft-graph-mailmicrosoft-graph-data-connect
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

trungpn17 avatar image
0 Votes"
trungpn17 answered

After testing, it seems that Office365 has changed the way to query for Message Trace. It became like this

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTrace?$top=2000&$skiptoken=2000&$filter=(StartDate eq StartDate ') and (EndDate eq datetime'EndDate')

instead of

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTrace?$top=2000&$skiptoken=2000&$filter=StartDate eq 'StartDate' and EndDate eq datetime'EndDate'

I fixed it and it works fine. Thanks for care.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.