I'm trying to download/upload the MSI of an Intune mobile app.
I can get the app list using:
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps
I can also get the details of a single mobile app using:
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/42454cd8-cba9-4946-bae2-b66e7ca54799/
But getting the content versions of the mobile app using the following calls fails:
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/42454cd8-cba9-4946-bae2-b66e7ca54799/contentVersions
or
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/42454cd8-cba9-4946-bae2-b66e7ca54799/microsoft.graph.managedMobileLobApp/contentVersions
or
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/42454cd8-cba9-4946-bae2-b66e7ca54799/microsoft.graph.mobileLobApp/contentVersions
The documentation says that all three versions should work: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/intune_apps_managedmobilelobapp_list_mobileappcontent
But I always get the error:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'contentVersions'.",
"innerError": {
"request-id": "94029de8-0bd4-4726-9138-d3c785e91be3",
"date": "2017-08-18T20:58:50"
}
}
}
or
{
"error": {
"code": "No method match route template",
"message": "No OData route exists that match template ~/singleton/navigation/key/cast/navigation with http verb GET for request /StatelessAppMetadataFEService/deviceAppManagement/mobileApps('42454cd8-cba9-4946-bae2-b66e7ca54799')/$/microsoft.management.services.api.managedMobileLobApp/contentVersions.",
"innerError": {
"request-id": "b1167613-6f5e-409d-835d-e2774d58e14a",
"date": "2017-08-18T20:59:14"
}
}
}
Do i not understand the documentation correctly or is there anything else I'm doing wrong? Thanks for helping.
@Tobi To quickly see the answer skip until you see ANSWER
As you have correctly stated, the full app list along with their metadata can be obtain via:
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps
In that you will get a list of mobileLobApps and managedMobileLobApps. For example:
A mobileLobApp metadata
{
"@odata.type": "#microsoft.graph.androidLobApp",
"id": "<the GUID for mobileLobApp>",
"displayName": "TestApp.apk",
"description": "TestApp.apk",
"publisher": "testPublisher",
"largeIcon": null,
"createdDateTime": "<some date>",
"lastModifiedDateTime": "<some date>",
"isFeatured": false,
"privacyInformationUrl": null,
"informationUrl": null,
"owner": null,
"developer": null,
"notes": null,
"uploadState": 1,
"committedContentVersion": "2",
"fileName": "TestApp.apk",
"size": 1262448,
"identityVersion": "110",
"identityName": "<some test app info>",
"minimumSupportedOperatingSystem": {
"v4_0": true,
"v4_0_3": false,
"v4_1": false,
"v4_2": false,
"v4_3": false,
"v4_4": false,
"v5_0": false,
"v5_1": false
},
"versionName": null,
"versionCode": "<version info here>"
},
A managedMobileLobApp metadata
{
"@odata.type": "#microsoft.graph.managedIOSLobApp",
"id": "<the GUID for managedMobileLobApp>",
"displayName": "<Display name of the managed App>",
"description": "<desc>",
"publisher": "<publisher>",
"largeIcon": null,
"createdDateTime": "<date time info>",
"lastModifiedDateTime": "<date/time info>",
"isFeatured": false,
"privacyInformationUrl": "",
"informationUrl": null,
"owner": "",
"developer": "",
"notes": "",
"uploadState": 1,
"appAvailability": "lineOfBusiness",
"version": "\"398c8e35-60db-4f07-a424-e17484a48f30\"",
"committedContentVersion": "1",
"fileName": "Excel_DF_2_4_17070200.ipa",
"size": 138493616,
"identityVersion": "2.4.17070200",
"bundleId": "com.microsoft.Office.Excel-dogfood",
"applicableDeviceType": {
"iPad": true,
"iPhoneAndIPod": true
},
"minimumSupportedOperatingSystem": {
"v8_0": false,
"v9_0": true,
"v10_0": false,
"v11_0": false
},
"expirationDateTime": "2017-12-05T23:55:42Z",
"versionNumber": null,
"buildNumber": "2.4.17070200"
},
In your case you can simply get the app metadata for your particular app via:
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/42454cd8-cba9-4946-bae2-b66e7ca54799
From the response of the above GET call you can figure out whether the app is managed (managedMobileLobApp) or not(mobileLobApp), by looking at the @odata.type.
ANSWER: If the app is non-managed, th the following call should give you the contentVersions
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/42454cd8-cba9-4946-bae2-b66e7ca54799
/microsoft.graph.mobileLobApp/contentVersions
Else, if the app is managed then:
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/42454cd8-cba9-4946-bae2-b66e7ca54799
/microsoft.graph.managedMobileLobApp/contentVersions
Reason: the call should work with base (mobileLobApp or managedMobileLobApp) as well as the derived type of the app:
(In case you need to know the graph schema for all the supported app types go here enter link description here)
On a side note: By the time you submitted the question the above call was broken. However, the solution given by @Andrei Fedorov has been working all the time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With