SOLVED

Teams User eine Rufnummer Nummer aus CSV zuweisen

%3CLINGO-SUB%20id%3D%22lingo-sub-1837722%22%20slang%3D%22de-DE%22%3EAssign%20teams%20users%20a%20phone%20number%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1837722%22%20slang%3D%22de-DE%22%3E%3CP%3EHello%20together%2C%3C%2FP%3E%3CP%3EI%20try%20to%20add%20a%20phone%20number%20to%20the%20Teams%20User%20via%20a%20CSV.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20CSV%20accounts.csv%20is%20structured%20as%20follows%3A%3C%2FP%3E%3CP%3EIdetntity%2CURI%3C%2FP%3E%3CP%3E%3CA%20href%3D%22mailto%3Aemail1%40mail.com%2C%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Eemail1%40mail.com%2C%3C%2FA%3E%20tel%3A%2B49123456789%3C%2FP%3E%3CP%3E%3CA%20href%3D%22mailto%3Aemail2%40mail.com%2C%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Eemail2%40mail.com%2C%3C%2FA%3E%20tel%3A%2B49234567891%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I%20try%20to%20read%20the%20CSV%20with%20the%20following%20commands.%3C%2FP%3E%3CP%3E%24dataSetFilePath%20%3D%20%22C%3A%22Users%22%20--%20%24dataSetFilePath%20%24dataSet%20%22%24item%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20in%20%24dataSet%22%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20--%20%24Identity%20%3D%20%24item.Identity%20%3CBR%20%2F%3E%20%24URI%20%3D%20%24item.%20URI%20%3CBR%20%2F%3E%20Set-CsUser%20-Identity%20%24Identity%20-EnterpriseVoiceEnabled%20%24true%20-HostedVoiceMail%20%24true%20-OnPremLineURI%20%24URI%20%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I%20get%20the%20following%20error%20and%20don't%20get%20where%20the%20crack%20point%20is%3A%3C%2FP%3E%3CP%3EThe%20filter%20did%20not%20return%20a%20unique%20result%2C%20%22%5BSipAddress%20%3A%20sip%3Aemail1%40mail.com%5D%20%5BLineURI%20%3A%20%3CBR%20%2F%3E%20tel%3A%2B49123456789%5D%20%5BPrivateLine%20%3A%20tel%3A%2B49123456789%5D%20%22.%20%3CBR%20%2F%3E%20%2B%20CategoryInfo%20%3A%20InvalidOperation%3A%20(Set-CsUser%3AString)%20%5BSet-CsUser%5D%2C%20InvalidOperationException%20%3CBR%20%2F%3E%20%2B%20FullyQualifiedErrorId%20%3A%20ProcessRecord%2CMicrosoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet%20%3CBR%20%2F%3E%20%2B%20PSComputerName%20%3A%20admin3e.online.lync.com%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1837722%22%20slang%3D%22de-DE%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1843432%22%20slang%3D%22de-DE%22%3ESubject%3A%20Assign%20Teams%20User%20a%20phone%20number%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1843432%22%20slang%3D%22de-DE%22%3E%3CP%3EI'm%20trying%20to%20add%20a%20phone%20number%20to%20the%20team%20users%20via%20CSV.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20CSV%20accounts.csv%20is%20structured%20as%20follows%3A%3C%2FP%3E%3CP%3EIdetntity%2CURI%3C%2FP%3E%3CP%3Eemail1%40mail.com%2C%20tel%3A%2B49123456789%3C%2FP%3E%3CP%3Eemail2%40mail.com%2C%20tel%3A%2B49234567891%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I%20try%20to%20read%20the%20CSV%20with%20the%20following%20command.%3C%2FP%3E%3CP%3E%24dataSetFilePath%20%3D%20%22C%3A%22Users%22%20--%20%24dataSet%20%22%24item%20in%20%24dataSet%22%20-%20%24Identity%20%3D%20%24item%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20%3CBR%20%2F%3E%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20%24dataSetFilePath%20%3CBR%20%2F%3E%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20%3CBR%20%2F%3E%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20%3CBR%20%2F%3EIdentity%20%3CBR%20%2F%3E%20%24URI%20%3D%20%24item.%20URI%20%3CBR%20%2F%3E%20Set-CsUser%20-Identity%20%24Identity%20-EnterpriseVoiceEnabled%20%24true%20-HostedVoiceMail%20%24true%20-OnPremLineURI%20%24URI%20%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I%20get%20the%20following%20error%20and%20can't%20figure%20out%20where%20the%20crack%20is%3A%3C%2FP%3E%3CP%3EThe%20filter%20did%20not%20return%20a%20unique%20result%2C%20%22%5BSipAddress%20%3A%20sip%3Aemail1%40mail.com%5D%20%5BLineURI%20%3A%20%3CBR%20%2F%3E%20tel%3A%2B49123456789%5D%20%5BPrivateLine%20%3A%20tel%3A%2B49123456789%5D%20%22.%20%3CBR%20%2F%3E%20%2B%20CategoryInfo%20%3A%20InvalidOperation%3A%20(Set-CsUser%3AString)%20%5BSet-CsUser%5D%2C%20InvalidOperationException%20%3CBR%20%2F%3E%20%2B%20FullyQualifiedErrorId%20%3A%20ProcessRecord%2CMicrosoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet%20%3CBR%20%2F%3E%20%2B%20PSComputerName%20%3A%20admin3e.online.lync.com%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ETranslated%20with%20%3CA%20href%3D%22http%3A%2F%2Fwww.DeepL.com%2FTranslator%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20www.DeepL.com%2FTranslator%20%3C%2FA%3E%20(free%20version)%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

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

 

 

2 Replies

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)

best response confirmed by _-loading-_ (New Contributor)
Solution
I found the problem. Some numbers was already given to some users. After i deletet the numbers the import from the csv is working.