question

RogerRoger-2394 avatar image
0 Votes"
RogerRoger-2394 asked RogerRoger-2394 answered

Delete Meeting invite

Hi All

i have a meeting invite which needs to be deleted on 5000 mailboxes. The meeting invite was sent on July 24 and the meeting is scheduled to be on July 30.
The meeting subject is Test’abc Test!! The below syntax i believe should work for me. but i don't want to search the entire mailbox rather than search on July 24 to todays date and delete the meeting invite, if it searches for 5000 mailboxes it will take lot of time to delete. Experts how do i reduce the time to delete the meeting invite. How do i add the date condition.

$mbx = Import-Csv c:\temp\list.csv
foreach($mailbox in $mbx){
Search-Mailbox -Identity $mailbox.Name -SearchQuery "kind:meetings AND Subject:'Test’abc Test!!' From:user1@contoso.com" -DeleteContent -Force
}

office-exchange-server-administrationoffice-exchange-online-itprooffice-exchange-server-mailflowoffice-exchange-server-itpro
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.

KaelYao-MSFT avatar image
0 Votes"
KaelYao-MSFT answered KaelYao-MSFT edited

Hi @RogerRoger-2394

If you would like to add the date condition to the filter, the command would be like:

 Search-Mailbox -Identity $mailbox.Name -SearchQuery {kind:meetings AND Subject:"Test’abc Test!!" AND From:"user1@contoso.com" AND Received:"07/24/2021"} -DeleteContent -Force

You can add the parameter "Recived:MM/DD/YYYY" to it.


In addition, to make sure only the correct items will be deleted, instead of using DeleteContent directly, I would suggest first using this command to generate a report of the search result and send it to admin's inbox.

 Search-Mailbox -Identity $mailbox.Name -SearchQuery {kind:meetings AND Subject:"Test’abc Test!!" AND From:"user1@contoso.com" AND Received:"07/24/2021"} -TargetMailbox admin@contoso.com -TargetFolder inbox -Logonly -Loglevel full

If the response 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.

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.

RogerRoger-2394 avatar image
0 Votes"
RogerRoger-2394 answered KaelYao-MSFT converted comment to answer

is the below syntax correct if i give date range

 $mbx = Import-Csv c:\temp\list.csv
 foreach($mailbox in $mbx){
 Search-Mailbox -Identity $mailbox.Name -SearchQuery {kind:meetings AND Subject:"Test’abc Test!!" AND From:"user1@contoso.com" AND Received:07/24/2021..07/25/2021"} -DeleteContent -Force
 }
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.

KaelYao-MSFT avatar image
0 Votes"
KaelYao-MSFT answered

Hi,

Yes it should work for you.

While you missed a " before 07/24/2021.

 AND Received:"07/24/2021..07/25/2021"

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.

RogerRoger-2394 avatar image
0 Votes"
RogerRoger-2394 answered KaelYao-MSFT commented

KaelYao
i am unable to mark the answer as accept

· 1
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.

Hi,

Which answer are you unable to mark as accept? My first post or my comment under your answer?

If it is this comment,
119653-13.png
it is the expected behavior :You cannot mark a comment as an answer to the question.

I have converted it to an answer, are you able to mark it as answer?


0 Votes 0 ·
13.png (8.0 KiB)
RogerRoger-2394 avatar image
0 Votes"
RogerRoger-2394 answered

thanks i have marked it as answer

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.