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

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

在此处输入图像描述

在此处输入图像描述

4

1 回答 1

0

我们只是在最后检查了它,我们能够将电话号码分配给用户。您可以尝试使用以下命令来更新用户详细信息吗?

$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
}
于 2021-08-19T07:23:55.543 回答