1

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}
1
  • Assuming the csv has a column named "email", it should be ($user.email + ':\calendar') Commented Jan 17, 2020 at 17:22

1 Answer 1

2

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'
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. Now it says "An existing permission entry was found for user: test." Does that mean it worked and that I had that user in the csv?
I think so. I'm not well versed in the Exchange cmdlets but that seems like an error/warning that could come from the Add-MailboxFolderPermission cmdlet, if the permission was already set.
@Sm85 It means that the [email protected] account already had Editor access to the mailbox in question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.