Forum Discussion

_-loading-_'s avatar
_-loading-_
Copper Contributor
Oct 30, 2020
Solved

Teams User eine Rufnummer Nummer aus CSV zuweisen

Hallo zusammen,

Ich versuche über eine CSV den Teams User eine Rufnummer hinzuzufügen.

 

Meine CSV accounts.csv ist wie folgt aufgebaut:

Idetntity,URI

email1@mail.com, tel:+49123456789

email2@mail.com, tel:+49234567891

 

Nun versuche ich mit dem folgenden Befehlen die CSV auszulesen.

$dataSetFilePath = "C:\Users\admin\Desktop\CSV\account.csv "
$dataSet = Import-Csv "$($dataSetFilePath)" –delimiter ","
foreach($item in $dataSet)
{
$Identity = $item.Identity
$URI = $item.URI
Set-CsUser -Identity $Identity -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI $URI
}

 

Ich erhalte aber folgenden Fehler und komm nicht darauf wo der knackpunkt ist:

Der Filter hat kein eindeutiges Ergebnis zurückgegeben, "[SipAddress : sip:email1@mail.com] [LineURI :
tel:+49123456789] [PrivateLine : tel:+49123456789] ".
+ CategoryInfo : InvalidOperation: (Set-CsUser:String) [Set-CsUser], InvalidOperationException
+ FullyQualifiedErrorId : ProcessRecord,Microsoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet
+ PSComputerName : admin3e.online.lync.com

 

 

  • I found the problem. Some numbers was already given to some users. After i deletet the numbers the import from the csv is working.
  • _-loading-_'s avatar
    _-loading-_
    Copper Contributor

    I'm trying to add a phone number to the team users via CSV.

     

    My CSV accounts.csv is structured as follows:

    Idetntity,URI

    email1@mail.com, tel:+49123456789

    email2@mail.com, tel:+49234567891

     

    Now I try to read the CSV with the following command.

    $dataSetFilePath = "C:\Users\admin\Desktop\CSV\account.csv "
    $dataSet = Import csv "$($dataSetFilePath)" -delimiter ","
    foreach($item in $dataSet)
    {
    $Identity = $item.Identity
    $URI = $item.URI
    Set-CsUser -Identity $Identity -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI $URI
    }

     

    But I get the following error and can't figure out where the crack is:

    The filter did not return a unique result, "[SipAddress : sip:email1@mail.com] [LineURI :
    tel:+49123456789] [PrivateLine : tel:+49123456789] ".
    + CategoryInfo : InvalidOperation: (Set-CsUser:String) [Set-CsUser], InvalidOperationException
    + FullyQualifiedErrorId : ProcessRecord,Microsoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet
    + PSComputerName : admin3e.online.lync.com


    Translated with www.DeepL.com/Translator (free version)

    • _-loading-_'s avatar
      _-loading-_
      Copper Contributor
      I found the problem. Some numbers was already given to some users. After i deletet the numbers the import from the csv is working.

Resources