Hello,
The script is able to locate the specific Folder but is unable to delete it. I receive no error messages. Permission on Account in the production tenant is the same as the QA environment. I'm running this script with UPN credentials. This script in QA works as expected. I am unable to retrieve the UniqueFolderID whereas I can in the QA environment. Is there anything I can do to make it so the code can retrieve the UniqueFolderID?
All Outlook users are located in Exchange Online
#$folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Root, $_.Account)
$folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot, $_.Account)
try {
$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, $folderid)
}
catch {
Write-Host "Inbox cannot be found on $Account"
continue
}
Thanks,