I'm not sure why the error is appearing. I'm importing a csv file
$Mailboxes = import-csv C:\users.csv
Foreach ($User in $Mailboxes)
{Add-mailboxfolderpermission –identity ($user+':\calendar’) –user [email protected] –Accessrights Editor}
I'm not sure why the error is appearing. I'm importing a csv file
$Mailboxes = import-csv C:\users.csv
Foreach ($User in $Mailboxes)
{Add-mailboxfolderpermission –identity ($user+':\calendar’) –user [email protected] –Accessrights Editor}
You are trying to add a string to a PSCustomObject, which is the resulting type you get when importing a CSV with Import-Csv. op_Addition is the method name which non-primitive types can implement when overloading the addition operator, which the error indicates that the $user object does not support an addition operation.
Remember that importing a CSV gives you an array of PSCustomObject, and each element in the collection is an object representation of a row in the CSV, not a string of the CSV row itself.
What you probably want is to add that string to a row's rolumn in that CSV. You would do this like so:
$user.ColumnName + ':\calendar'
Add-MailboxFolderPermission cmdlet, if the permission was already set.[email protected] account already had Editor access to the mailbox in question
($user.email + ':\calendar')