Hello everybody,
we are searching for a solution for a problem we cannot find a solution for at the moment. We have an automated process with a script to create new mailboxes and in this script one part is the create an inbox rule that all junk-mails forwards into the junk-mail-folder of the mailbox. The problem is, that the junk-mail-folder at this stage of the process not exists nor its name is known. The Mailbox exists already at this stage, also all mail addresses or any other preparations like policies.
We have tried to get the name with this powershell command:
$j = (Get-MailboxFolderStatistics -Identity $user | where {$_.foldertype -eq "JunkEMail"}).name
But $j is empty and therefore we are unable to create the inboxrule. Has anybody an idea how we can get the name of the junk-mail-folder without logging on to the mailbox, which is not really possible in an automated process and also not wanted? We would appreciate any idea or suggestion to solve this problem.
Thank you.