A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
According to your description above, you want to collect all the message IDs for the messages related to outbound spam filter policy right?
If so, I would suggest you use the search feature with keywords to filter them.
For more information about Message center and Configure outbound spam filtering in EOP
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.