Forum Discussion
Mailbox Rules, PowerShell and Scripting.
ok so here is where i am on it. So far this almost works:
$Importlist = Import-CSV Test_Email_Rule.csv
foreach ($SingleImport in $importlist)
{
New-InboxRule -Mailbox $($SingleImport.PrimarySMTPAddress) -From user.name@domain.com -MyNameInToBox $True -SubjectContainsWords '["Receipt Copy"] Hello' -Name RAKEmailG4 -MoveToFolder "$($SingleImport.PrimarySMTPAddress):\Sent Items"
}
The above script appears to work, however when it comes to moving the item to the users sent items folder it fails.
If i remove MovetoFolder Option and select -Deletemessage $True then it works. However i dont want to delete the message.
I am attaching an screenshot as well.
Showing error
- Robert BollingerSep 15, 2021Iron Contributor
Thanks for the response. Actually it turns out the problem was related to not having full mailbox access rights to the mailboxes in which i am trying to create the rule. I was testing with my 3 test accounts and those worked as expected. However my other test accounts did not.
I did some additional checking and found an article covering the need for full mailbox rights, but only when setting a rule which touches the users mailbox folders.
Thanks for your help.