Created
August 6, 2020 18:19
-
-
Save waldekmastykarz/bc75ad7c4dca0bc1cd81cdcfab516d4a to your computer and use it in GitHub Desktop.
Move Outlook emails from Inbox to Archive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OFFICE365CLI_AADAPPID=31... OFFICE365CLI_TENANT=b4... m365 outlook message list --folderName inbox -o json --query '[].id' > emails.txt | |
i=0 | |
cat emails.txt | jq -c '.[]' | while read msgId; do | |
i=$((i+1)) | |
echo "Archiving $i..." | |
OFFICE365CLI_AADAPPID=31... OFFICE365CLI_TENANT=b4... m365 outlook message move --sourceFolderName inbox --messageId $msgId --targetFolderName archive | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment