---
title: Trace Exchange Messages with Python
slug: user-guide-10x/trace-exchange-messages-with-python
docTags: 
createdAt: 2025-06-18T11:01:38.787Z
---

﻿You can ingest security alarm data, such as candidate phishing email messages, using the sw\_microsoft\_exchange plugin. The Exchange plugin targets the [Exchange EWS](https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/start-using-web-services-in-exchange) APIs via the [Python exchangelib](https://pypi.org/project/exchangelib/).

The Exchange plugin currently does not offer message tracing. Yet, you may want to know the answer to a question like, "How many people in an organization have received a known malicious email message?" This topic explains how you can discover the answer.

To trace Exchange messages with Python:

1. [Install the Python package](docId\:U04uB6Zff4YOkpsoWEFPf) *pypsrp.*
2. Create a Python task with script similar to this:

For more information, contact your Swimlane Professional Services representative.

:::hint{type="info"}
Powershell users can accomplish message tracing objectives with the [Exchange Online PowerShell V2 module](https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps) and/or the [Get-MessageTrace cmdlet](https://docs.microsoft.com/en-us/powershell/module/exchange/get-messagetrace?view=exchange-ps).
:::

