user12235434
user12235434

Reputation:

Method invocation failed … does not contain a method named 'op_Addition'

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}

Upvotes: 0

Views: 1732

Answers (1)

codewario
codewario

Reputation: 21418

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'

Upvotes: 2

Related Questions