正在为用户 Microsoft 团队分配 phone 号码

Assigning phone number to users microsoft teams

$Util2 = Get-PnPListItem -List "2"

foreach ($temp2 in $Util2) {

$CQNom = $temp2['CQ_nom']
$CQMail = $temp2['CQ_Compte_de_ressource']
$CQNum = $temp2['Tel_sda']    


# config
$cqName = $CQNom

# Create resource account of call queue type
$cqRaParams = @{
UserPrincipalName = $CQMail
# ID taken from cmdlet documentation
ApplicationId     = '11cd3e2e-fccb-42ad-ad00-878b93575e07'
DisplayName       = "RA_$cqName"
}
$newCqRa = New-CsOnlineApplicationInstance @cqRaParams

#Assign licenses to users
$User = Get-AzureADUser -ObjectId $newCqRa.ObjectId
Set-AzureADUser -ObjectId $User.ObjectId -UsageLocation US
$License = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense
$License.SkuId = "440eaaa8-b3e0-484b-a8be-62870b9ba70a"
$LicensesToAssign = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses
$LicensesToAssign.AddLicenses = $License
Set-AzureADUserLicense -ObjectId $User.ObjectId -AssignedLicenses $LicensesToAssign

#Assign number
Set-CsOnlineApplicationInstance -Identity $newCqRa.ObjectId -OnpremPHONENUMBER $CQNum }

我的程序有问题。我正在为存储在 Sharepoint 列表中的多个用户创建一个呼叫队列。在我必须为它们分配 phone 数字的时候,它显示了一个错误。有人可以帮助我吗?

The application endpoint was not found in Active Directory.
+ CategoryInfo          : NotSpecified: (:) [Set-CsOnlineApplicationInstance], ApplicationInstanceManagementException 
+ FullyQualifiedErrorId : Microsoft.Rtc.Management.Hosted.PlatformService.ApplicationInstance.ApplicationInstanceMa   nagementException,Microsoft.Rtc.Management.Hosted.PlatformService.ApplicationInstance.SetCsOnlineApplicationInstanceCmdlet  
+ PSComputerName        : api.interfaces.records.teams.microsoft.com


The application endpoint was not found in Active Directory.
+ CategoryInfo          : NotSpecified: (:) [Set-CsOnlineApplicationInstance], ApplicationInstanceManagementException
+ FullyQualifiedErrorId : Microsoft.Rtc.Management.Hosted.PlatformService.ApplicationInstance.ApplicationInstanceMa   nagementException,Microsoft.Rtc.Management.Hosted.PlatformService.ApplicationInstance.SetCsOnlineApplicationInstanceCmdlet
+ PSComputerName        : api.interfaces.records.teams.microsoft.com

注意:当我运行这个程序在单个用户上时它工作正常。

我们刚刚检查了一下,我们能够将 phone 号码分配给用户。您可以尝试使用以下命令来更新用户详细信息吗?

 $personList = @{upn='sip:uset1@contoso.com';phoneNumber='tel:+14250000000'},@{upn='sip:uset2@contoso.com';phoneNumber='tel:+14250000001'}
Foreach($item in $personList)
{
Set-CsUser -Identity $item.upn  -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI $item.phoneNumber
}