Microsoft Graph Intune: How to get the icons of company apps - microsoft-graph-api

I'm developing an company app that pulls the data from company's cloud services using Microsoft Graph. At this moment I'm trying to get the list of the company apps using the Graph Intune API which is /deviceAppManagement/mobileApps.
However, it does not return the address of the icon of each of the apps and they are all null. The icons were set in Intune portal and they are displayed properly in Company Portal App. Is there any way that I can have those icons?

#Jason_wun
In summary: If we set the Logo properly we should get the largeIcon with base64 encoded string.
In detail:
First let us verify whether the Logo is uploaded properly. (I'm sure
you have done it correctly, because you see it in Company Portal
app, but just for the sake of completeness).
In portal.azure.com go to, Intune-> Mobile apps -> Apps
Select the app you want to update/add the icon, then go to Properties -> App information -> Logo
Upload the Logo there (I used an PNG format to reproduce this scenario).
We should get the message "Upload Completed for " for successful uploads.
Now let's make the GET call to obtain the icon as well as other app related metadata
As you have correctly done, make the following graph call to get the metadata for your app
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/xxxxxxxx-xxxx-xxxx-GUID-SAMPLExHEREx
Then we should get a response with a format similar to the one shown below:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#deviceAppManagement/mobileApps/$entity",
"#odata.type": "#microsoft.graph.androidLobApp",
"id": "xxxxxxxx-xxxx-xxxx-GUID-SAMPLExHEREx",
"displayName": "<Display name of your app>",
"description": "<Some description>",
"publisher": "<publisher name>",
"largeIcon": {
"type": "image/png",
"value": "iVBORw0KGgoAAAANSUhEUgAAAHoAAABtCAIAAADh6OKQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAQASURBVHhe7ZzteaswDEY7FwNlnkyTZTJMrw2SLQkbAs19a9L3/CqWP+qDEQX89OubAKFuKNQNhbqhUDcU6oZC3VCoGwp1Q6FuKNQNhbqhUDcU6oZC3VCoGwp1Q6FuKNQN5Uq6H7evzO0hxxfkBd3P+zRPc7o/peSXoG4o1A1l+UV+/df4Ced0Px/327SUJqbp5hQ8U7CE7g8TmttJaGlXozJMGuX5KJ27nle6+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2FuqFQNxTqhkLdUKgbCnVDoW4o1A2FuqFQNxTqhkLdUKgbCnVDoW4g39//AGOcjUiB9dTTAAAAAElFTkSuQmCC"
},
"createdDateTime": "2018-01-09T23:08:32.1089504Z",
"lastModifiedDateTime": "2018-01-09T23:41:37.5000422Z",
"isFeatured": true,
"privacyInformationUrl": null,
"informationUrl": null,
"owner": "",
"developer": "",
"notes": "",
"uploadState": 1,
"committedContentVersion": "2",
"fileName": "<Your app file name>",
"size": 4426224,
"identityVersion": "103185025",
"identityName": "<reversed domain name type>",
"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": "10.3.185.25",
"versionCode": "103185025"
}
In the response JSON above, the icon data can be obtained from the "value" of "largeIcon" property. The important thing to know is that, the string given under value of largeIcon is not the address of the icon but rather the actual image data encoded with base64 format.
In this example response the the value mentioned here is from an actual image which can be seen with a base64 decoder.
To see the image quickly just copy the value of largeIcon and go to: decodebase64.com
Paste the string in the text box with caption "Base64 (automatically decoded)"
Under "Options" click "Decode as Image"
You will see an image with text "Jason's sample Icon" :)
In summary to obtain the image we need to decode the base64 encoded value of largeIcon.
On a side note: If you want to get the icon information only (excluding the other app metadata the following call might be helpful.
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/<GUID of the app's Id here>?$select=largeIcon

Related

Unfurl links blocks template

I'm using the link_shared events to unfurl links in my workspace, trying to generate a template that is as close to Slack's unfurling template as possible, but I have several issues -
Blocks have very large spacing between them, causing my 3 blocks to take a lot of space
I'm unable to have an image inlined with the text for the title, unless I'm using context, but this is causing the text to be very small.
Taking Slack's example of how link unfurling should look like and trying to mimic it with blocks should explain the differences. This is the blocks message, and here you can see the result as an image
So my main question is - does Slack use some internal blocks formatting not available in the API, or is it possible to achieve the same result?
Thanks a lot!
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":pager: *Slack*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<https://slack.com/features|Features>*"
}
},
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Slack is where work flows. It's where the people you need, the information you share, and the tool you use come together to get things done.",
"emoji": true
},
"image_url": "https://a.slack-edge.com/13f94ee/marketing/img/homepage/self-serve-campaign/unfurl/img-unfurl-ss-campaign.jpg",
"alt_text": "Slack"
}
]
}
That example is not using the Slack block unfurl - it's an example of how a generic link would be displayed using the page's meta tags to display some additional information, using the favicon image.
If you wanted to create something similar you could use use a markdown block and an image block (like this) - but the file size would be displayed on a new line rather than after the text.
It took a bit of playing around, but I realized Slack is actually using message attachments (the legacy version of message formatting) in order to generate their link unfurls.
For example, if you want to unfurl a GitHub repository link, this is the payload you should send, and it'll generate an almost identical unfurling to what Slack is generating (a small Added by {app-name} will be added to the footer) -
unfurls["https://github.com/slackapi/bolt-js/"] = {
author_name: "GitHub",
author_icon: "https://a.slack-edge.com/80588/img/unfurl_icons/github.png",
title: "GitHub - slackapi/bolt-js: A framework to build Slack apps using JavaScript",
title_link: "https://github.com/slackapi/bolt-js/",
text: "A framework to build Slack apps using JavaScript. Contribute to slackapi/bolt-js development by creating an account on GitHub.",
image_url: "https://opengraph.githubassets.com/3e06f7eee96f05a53cd4905af3b296dfe333be7a902bb3e6a095770e87fd17fe/slackapi/bolt-js"
}

How to get OneNote Notebook/Section/Page Id from Teams Tab

I have embedded a OneNote notebook into a Microsoft Teams Tab. I am trying to get the Notebook Id using Graphi API
I can get the tab id from channels/{{ChannelId}}/messages/delta end point.
Using tabId, I can get tab details from channels/{{ChannelId}}/tabs/{{tabid}} end point.
Tab details end point gives configuration details that has contentUrl and websiteURL.
{
"id": "tabId",
"displayName": "My Contoso Tab - updated",
"configuration": {
"entityId": "2DCA2E6C7A10415CAF6B8AB6661B3154",
"contentUrl": "",
"websiteUrl": "",
"removeUrl": ""
},
"teamsApp": {
"id": "0d820ecd-def2-4297-adad-78056cde7c78",
"externalId": null,
"displayName": "Contoso",
"distributionMethod": "store"
},
"sortOrderIndex": "20",
"webUrl": ""
}
How can I get notebook Id or Section Id or Page Id that is embedded into the tab?
Formally the OneNote tab explicitly has no public documentation regarding its configuration as per :
https://learn.microsoft.com/en-us/graph/teams-configuring-builtin-tabs#onenote-tabs.
You can indeed try to reverse engineer the content or web URLs, and you may very well succeed today.
But you need to understand , and accept responsibility and the associated integration testing potential downtime as that URL format can/will change with no notification whatsoever.
If you can accept that risk & responsibility, using the oneNoteWebUrl= QSP from the contentUrl json node seems to be a decent key.
"configuration": {
"entityId": "00727f3d-df18-43ac-8cc9-698774312f5e",
"contentUrl": "https://www.onenote.com/teams/TabContent?notebookSource=Pick&notebookSelfUrl=https%3A%2F%2Fwww.onenote.com%2Fapi%2Fv1.0%2FmyOrganization%2Fgroups%0076777f1c-3e3d-44ad-8206-53ba08a44cec%2Fnotes%2Fnotebooks%007-ce5c7935-0960-41f0-a5ce-e82a6d365f45&oneNoteWebUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookName=TaaP%20Notebook&siteUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP&createdTeamType=Standard&oneNoteClientUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookIsDefault=true&ui={locale}&tenantId={tid}&upn={userPrincipalName}&groupId={groupId}&theme={theme}&entityId={entityId}&subEntityId={subEntityId}&sessionId={sessionId}&ringId={ringId}&teamSiteUrl={teamSiteUrl}&channelType={channelType}&trackingId={appSessionId}&hostClientType={hostClientType}",
"removeUrl": "https://www.onenote.com/teams/TabRemove?notebookSource=Pick&notebookSelfUrl=https%3A%2F%2Fwww.onenote.com%2Fapi%2Fv1.0%2FmyOrganization%2Fgroups%2F46777f1c-3e3d-44ad-8206-53ba08a44cec%2Fnotes%2Fnotebooks%2F1-ce5c7935-0960-41f0-a5ce-e82a6d365f45&oneNoteWebUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookName=TaaP%20Notebook&siteUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP&createdTeamType=Standard&oneNoteClientUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookIsDefault=true&ui={locale}&tenantId={tid}&upn={userPrincipalName}&groupId={groupId}&theme={theme}&entityId={entityId}&subEntityId={subEntityId}&sessionId={sessionId}&ringId={ringId}&teamSiteUrl={teamSiteUrl}&channelType={channelType}&trackingId={appSessionId}&hostClientType={hostClientType}",
"websiteUrl": "https://www.onenote.com/teams/TabRedirect?redirectUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook",
--> `oneNoteWebUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook'
--> urldecode
https://m365x432007.sharepoint.com/sites/TaaP/SiteAssets/TaaP%20Notebook
The response of channels/{{ChannelId}}/tabs/{{tabid}} will contain details for tab and will not return details for the embedded onenote notebooks and pages. However you can get details for onenote notebooks and pages using https://graph.microsoft.com/v1.0/me/onenote/notebooks
You can refer below document for more information
https://learn.microsoft.com/en-us/graph/integrate-with-onenote
https://learn.microsoft.com/en-us/graph/api/resources/onenote-api-overview?view=graph-rest-1.0
Thanks

ms botframework attachment can not generate sharelink

I use botframework api to send message to users.
the message contains attachment.
So I send the activity like this
{
"attachments": [{
"contentType": "application/vnd.microsoft.teams.card.file.info",
"contentUrl": "https://contoso.sharepoint.com/personal/johnadams_contoso_com/Documents/Applications/file_example.txt",
"name": "file_example.txt",
"content": {
"uniqueId": "1150D938-8870-4044-9F2C-5BBDEBA70C8C",
"fileType": "txt",
}
}]
}
And I send bot message to user like this
And I want to generate sharelink by clicking this button
But I got a error that told me I can's generate sharelink
Does anyone knows the reason?
This issue is confirmed by the original post that it's caused by incorrect uniqueID. The uniqueID is not the itemID in one drive.
For more information about different IDs for botframework, please refer to document here: https://learn.microsoft.com/en-us/previous-versions/azure/bot-service/bot-service-resources-identifiers-guide?view=azure-bot-service-3.0

Slack message JSON, image not showing

I'm building a simple Slack integration. I've got a web app running on a public URL that is returning json like so when my slash command is called:
{
"text": "<http://lorempixel.com/image_output/animals-q-c-640-480-4.jpg>"
}
If I paste that JSON in to their format testing tool, it shows the image as expected. But, when I actually test the slash command in Slack, where my web app returns the exact same JSON, Slack shows the image url as a link, but doesn't show the image.
Thoughts?
I got it to work with having the image in the text AND attachment:
{
"parse": "full",
"response_type": "in_channel",
"text": "<http://lorempixel.com/image_output/animals-q-c-640-480-4.jpg>",
"attachments": [
{
"image_url": "http://lorempixel.com/image_output/animals-q-c-640-480-4.jpg"
}
],
"unfurl_media": true,
"unfurl_links": true
}
This doesn't appear to jive with the documentation and other examples I've seen, but at least it's working now!

Get Recommendation from LinkedIn API returns empty map [:] as response

I have created a web application from which I am trying to get recommendations of a user from his/her LinkedIn Profile using URL
String url="https://api.linkedin.com/v1/people/~:(recommendations-received:(id,recommendation-type,recommendation-text,recommender))?format=json"
When I am using this URL in the
Api Explorer it works fine. And gives output:-
{ "recommendationsReceived": {
"_total": 2,
"values": [
{
"id": 558598601,
"recommendationText": "xxx is among the best team players I ever worked with. He has handled client effectively with smooth operations. I had always seen him as person with solution mindset and always look for solution rather than thinking about the problem. ",
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXX"
}
},
{
"id": ZZZZ,
"recommendationText": "XXX is one of the most dedicated person at work.I always him with a flexible attitude and ready to adapt himself in all situation.I have seen him work all night to catch up all the deadlines and deliver on time ."
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXXX"
}
}
] } }
The problem comes, when I am using this URL in my Developer app.It doesn't give any error just simple return an empty map [:] as output in response
Irrespective of these recommendation fields, I successfully get the user basic profile data such as email, id, image,firstName,lastName.Means my code is working for other fields well but not for these recommendation fields*
To find the solution, I did some internet surfing and find a link of Linked API docs
Linked API Docs
As per Docs following selection of profile fields are only available
to applications that have applied and been approved for the Apply with
LinkedIn program:
Recommendation Fields
I already created a LinkedIn Developer account to get key & Secret
So how do I apply and get approval for Apply with LinkedIn Recommendation Fields.
I already have seen the LinkedIn support but can't find the way to ask question to the Linked Developer help support
Please suggest me the right way.
After a long internet surfing,I have found something fruitful that, I have to fill up a form to get these fields.Here is the form
along with its procedural details
You can use just recommendations-received keyword. Try the following link. I am getting all recommendations details with this link.
https://api.linkedin.com/v1/people/~:(recommendations-received)?format=json

Resources