none
Add-MailboxFolderPermission -Identity $_.Cal -User $_.User.split(";") -AccessRights Owner RRS feed

  • Question

  • I've the below CSV file

    User,Cal,Groupname,city,Title,Office
    TST-Ahameax;TST-Scrimrx,MBX-PublicRmTest12:\Calendar,crtest1,Lake County,Capacity:15

    Powershell script below

    $CSV1 = Import-Csv C:\temp\QATest1.csv
    $CSV1 | ForEach {

    [String]$result=$_.User.split(";")

    write-output $_.User.split(";")

    Add-MailboxFolderPermission -Identity $_.Cal -User $_.User.split(";") -AccessRights Owner

    #"Array: {0}" -f [String]$_.User.split(";")

    }

    When I run I get below error

    Cannot process argument transformation on parameter 'User'. Cannot convert the "System.Collections.ArrayList" value of
    type "System.Collections.ArrayList" to type "Microsoft.Exchange.Management.StoreTasks.MailboxFolderUserIdParameter".
        + CategoryInfo          : InvalidData: (:) [Add-MailboxFolderPermission], ParameterBindin...mationException
        + FullyQualifiedErrorId : ParameterArgumentTransformationError,Add-MailboxFolderPermission

    Please help me

    Tuesday, November 12, 2013 10:02 PM

All replies

  • I wrote myself

    $CSV1 = Import-Csv C:\temp\QATest1.csv
    $CSV1 | ForEach {

    $arr=$_.User
    $result=$arr.split(";")
    $TotalUsers=$result.GetUpperBound(0)+1


    for ($i=0; $i -lt $TotalUsers; $i++)
      {   

         
           Add-MailboxFolderPermission -Identity $_.Cal -User $result[$i] -AccessRights Owner
        }

    }

    Wednesday, November 13, 2013 7:07 PM