0

我正在尝试使用 Android 托管商店应用程序的 Graph API 将 PowerShell 中的发布请求发送到https://graph.microsoft.com/beta/deviceAppManagement/mobileApps,但我一直收到错误消息。这适用于其他 odata.types 但不适用于 androidManagedStoreApp。这是我的 JSON 数据:

{
"@odata.type":  "#microsoft.graph.androidManagedStoreApp",
"displayName":  "Microsoft Excel",
"description":  "Create Spreadsheets yo",
"publisher":  "Microsoft Corporation",
"largeIcon":  {
    "@odata.type": "microsoft.graph.mimeContent",
    "type": "Type value",
    "value": "dmFsdWU="
},
"isFeatured":  false,
"privacyInformationUrl":  "https://play.google.com/store/apps/details?id=com.microsoft.office.excel&hl=en_US",
"informationUrl":  "https://play.google.com/store/apps/details?id=com.microsoft.office.excel&hl=en_US",
"owner":  'james',
"developer":  'james',
"notes":  'james',
"uploadState":  0,
"publishingState":  "processing",
"isAssigned":  false,
"roleScopeTagIds":  [

                    ],
"dependentAppCount":  0,
"packageId":  "com.microsoft.office.excel",
"appIdentifier":  "com.microsoft.office.excel",
"usedLicenseCount":  0,
"totalLicenseCount":  1,
"appStoreUrl":  "https://play.google.com/store/apps/details?id=com.microsoft.office.excel&hl=en_US",
"isPrivate":  false,
"isSystemApp":  false,
"supportsOemConfig":  false,
"appTracks":  []

}

作为参考,我遵循了数据在 MS 上的格式

https://docs.microsoft.com/en-us/graph/api/intune-apps-androidmanagedstoreapp-create?view=graph-rest-beta

PowerShell代码:

$JSONData = Get-Content "C:\Kits\Excel.json"
$Endpoint = "https://graph.microsoft.com/beta/deviceAppManagement/mobileApps"
Invoke-WebRequest -Uri $Endpoint -Headers $Global:AuthToken -Method Post -Body $JSONData

这是我收到的错误:

Invoke-WebRequest : { "error": { "code": "BadRequest", "message": "{\r\n \"_version\": 3,\r\n \"Message\": \"一个错误已发生 - 操作 ID(用于客户支持):00000000-0000-0000-0000-000000000000 - 活动 ID:64234aa8-4195-4a11-a900-3ae515c385ee - 网址:htt ps://fef.amsua0202.manage.microsoft.com /AppLifecycle/StatelessAppMetadataFEService/deviceAppManagement/mobileApps?api-version=5020-03-19\",\r\n \"CustomApiErrorPhrase\": \"\",\r\n \"RetryAfter\": null,\ r\n \"ErrorSourceService\": \"\",\r\n \"HttpHeaders\": \"{}\"\r\n}", "innerError": { "request-id": "64234aa8 -4195-4a11-a900-3ae515c385ee”,“日期”:“2020-04-23T19:37:40”}}}

4

1 回答 1

0

Beta Graph API 通常有不正确的详细信息/示例,请始终检查每个值以查看其是否有意义。

看起来像uploadState, publishingState,isAssigned和是在服务器端确定的usedLicenseCounttotalLicenseCount因此您不需要提供它们的值。也许尝试在没有他们的情况下提出请求?

此外,largeIcon不符合规范,应该是

"largeIcon":  {
    "@odata.type": "#microsoft.graph.mimeContent",
    "type": "String",
    "value": "dmFsdWU="
}

请注意“microsoft”前面的“#”。

于 2020-04-27T02:40:31.347 回答