给用户分配号码microsoft teams


$credential = Get-Credential 
Connect-MicrosoftTeams -Credential $credential
Connect-AzureAD -Credential $credential
Connect-MsolService -Credential $credential
Connect-PnPOnline -Url "https://domain.sharepoint.com/sites/user"
#---------------------------------Call queue
$Util2 = Get-PnPListItem -List "2"
foreach ($temp2 in $Util2) {
$CQNom = $temp2['CQ_nom']
$CQMail = $temp2['CQ_Compte_de_ressource']
$CQNum = $temp2['Tel_sda']    

# Your 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
$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
Set-CsOnlineApplicationInstance -Identity $newCqRa.ObjectId -OnpremPHONENUMBER $CQNum }

我的程序有问题。我正在为存储在Sharepoint列表中的几个用户创建一个呼叫队列。当我要给他们分配电话号码时,它显示了一个错误。有人能帮我吗?

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

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

输入图片描述

输入图片描述

我们刚刚检查了一下,我们就可以给用户分配电话号码了。你可以试着用下面的命令来更新用户的详细信息吗?

$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
}

最新更新