大约一个月前,我在Powershell中编写了一个脚本,以每天从Skype for Business收集用户详细信息使用情况数据。在我编写该脚本时,该脚本成功提取了数据并将其记录到一个csv文件中。现在,当我运行此脚本时,API调用将成功执行并返回报告标头,但不会返回任何数据。有没有人注意到使用SkypeForBusiness报告端点的任何稳定性问题?
参考代码:
$redirectUrl = "https://localhost:8000"
$GraphAPIURI="https://graph.microsoft.com"
$client_id = "app-id"
$client_secret = "app-secret"
$delimiterHeader="sep=;`n"
$D7UserDetailOutput= "D7UserDetail.csv"
$D30UserDetailOutput= "D30UserDetail.csv"
$D90UserDetailOutput= "D90UserDetail.csv"
$D180UserDetailOutput= "D180UserDetail.csv"
Add-Type -AssemblyName System.Web
$tenantid="tenantid"
$url="https://login.microsoftonline.com/$tenantid/oauth2/v2.0/token"
$Auth =
Invoke-RestMethod -Method post `
-ContentType application/x-www-form-urlencoded `
-Uri $url `
-body "client_id=$client_id&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default&client_secret=$client_secret&grant_type=client_credentials"
$D7Detail=Invoke-RestMethod -Headers @{Authorization =("Bearer "+ $Auth.access_token)} `
-Uri "https://graph.microsoft.com/v1.0/reports/getSkypeForBusinessActivityUserDetail(period='D7')" `
-Method Get `
-TimeoutSec 60
$D30Detail=Invoke-RestMethod -Headers @{Authorization =("Bearer "+ $Auth.access_token)} `
-Uri "https://graph.microsoft.com/v1.0/reports/getSkypeForBusinessActivityUserDetail(period='D30')" `
-Method Get `
-TimeoutSec 60
$D90Detail=Invoke-RestMethod -Headers @{Authorization =("Bearer "+ $Auth.access_token)} `
-Uri "https://graph.microsoft.com/v1.0/reports/getSkypeForBusinessActivityUserDetail(period='D90')" `
-Method Get `
-TimeoutSec 60
$D180Detail=Invoke-RestMethod -Headers @{Authorization =("Bearer "+ $Auth.access_token)} `
-Uri "https://graph.microsoft.com/v1.0/reports/getSkypeForBusinessActivityUserDetail(period='D180')" `
-Method Get `
-TimeoutSec 60
$DataCollection=@($D7Detail,$D30Detail,$D90Detail,$D180Detail)
$FileCollection=@($D7UserDetailOutput,$D30UserDetailOutput,$D90UserDetailOutput,$D180UserDetailOutput)
$SfBUserDetail=""
$SfBUserDetail=Invoke-RestMethod -Headers @{Authorization =("Bearer "+ $Auth.access_token)} `
-Method Get `
-Uri "$($GraphAPIURI)/v1.0/reports/getSkypeForBusinessActivityUserDetail(date=$(Get-date -Date (get-date).AddDays(-1) -Format 'yyyy-MM-dd'))" `
-TimeoutSec 60
$SfBUserDetail | out-file "\\ADFS01\Brainwave Projects\DataWave\_Templates\O365Analytics\Skype for Business Data Storage\UserDetailReports\SkypeForBusinessUserDetail_$(Get-date -Date (get-date).AddDays(-1) -Format 'yyyy-MM-dd').csv" -Force:$true