Link to home
Start Free TrialLog in
Avatar of s a
s a

asked on

Outlook macro and O365

Hi, is there a way in Office365/online Exchange to set a rule to delete messages with a particular subject line after 3 days for ALL users? I think I can do this with an outlook macro locally but would rather do it in o365/online exchange centrally for all users.
Avatar of Michael B. Smith
Michael B. Smith
Flag of United States of America image

Sure. You can run a Search-Mailbox with DeleteContent every day.
Avatar of s a
s a

ASKER

Thank you, could you give me a more step by step process? Also, I don't want to do this one time....I want to have it run all the time for any mails with a particular subject gets deleted after 3 days.

Thanks.
Here is a great article on using Search-Mailbox: https://thoughtsofanidlemind.com/2014/10/17/using-search-mailbox-to-look-for-items-with-a-specific-date/. Here is the documentation for Search-Mailbox: https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/search-mailbox?view=exchange-ps.

As to performing the search every day - use Task Scheduler on a desktop or a server to connect to Exchange online once a day and then execute the cmdlet with the proper parameters (as covered above).
In case your need is best served by blocking these emails altogether, you can set up a mail flow rule which will delete the message before it enters your org; see here:
https://docs.microsoft.com/en-us/exchange/security-and-compliance/mail-flow-rules/mail-flow-rule-actions
Avatar of s a

ASKER

No, we want the emails...but just want to automatically delete them after 3 days
ASKER CERTIFIED SOLUTION
Avatar of J0rtIT
J0rtIT
Flag of Venezuela, Bolivarian Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- 'Jose Gabriel Ortega Castro' (https:#a42685234)
-- 'Adam the 32-bit Aardvark' (https:#a42685370)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

seth2740
Experts-Exchange Cleanup Volunteer