How to read attachment of the attached email using Microsoft Graph API - microsoft-graph-api

Do we know how to fetch attachments of the attached email using Microsoft Graph API ?
I have one requirement where I need to read such emails.
I have followed the below link by Microsoft but I can only ready body and not it's attachment
https://learn.microsoft.com/en-us/graph/outlook-get-mime-message

Related

Recall an email using Microsoft graph api

I am using microsoft graph api to fetch emails from office365. There is need to have recall functionality but not able to locate the required api.
Can someone help me in here. I am not sure if such API even exists
There is no endpoint in the Graph for message recall it's all private API's in the clients that implemented it. You could add this as a feature request for the the graph https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform

Retrieving the image of a user through Microsoft graph api

I am trying to fetch the image of a user based on email id from microsoft graph API.
I am able to get the details of the logged in user using https://graph.microsoft.com/v1.0/me/photo/$value .
What i need is image of another user based on email id. Is there a way to accomplish this?
Ref: Microsoft Graph API Explorer
You can use the below api from the graph explorer to get the photo
Goto Graph explorer page
Microsoft Graph Explorer
Paste the below api with email id of the user
https://graph.microsoft.com/v1.0/users/<email id>/photo/$value
It will retrieve photo of the user.

Can I send a OneDrive File Request using Microsoft's Graph API?

Microsoft OneDrive allows you to send a "file request" so others can send you very large files without needing a OneDrive account themselves.
I'm wanting to use an API (probably Microsoft Graph API)) to automatically create file requests on a user's behalf, and delete them later too.
Is it possible to create a OneDrive file request via an API? If so, where is that documented?
Thanks for your time!
Looks like that feature is not available yet. I see a feature request for the same in MS Graph user voice page. Please upvote/comment on the same so that the feature team will get better visibility.

Post Message to a Microsoft Teams Channel using App

I'm trying to post messages to specific Microsoft Teams Channels using Graph REST API (from my app). I'm looking at the following API endpoint, but it says it doesn't support Application permission type: Create chatMessage in a channel
Is there a better way than using the webhook/bots?
Currently, we don't have plans for posting messages with application permissions. Only option to send a message to channel using Graph API would be using delegated permission.
Please use Bot / Connectors to send messages.

Send message to personal Chat via Graph API

I read from here that getting a user's Teams chats that occurred outside the scope of a team or channel (1-to-1 chat conversation), you need to use this request
GET /users/id/messages
and Teams chat messages have "IM" as their subject.
My question now is whether it is possible to send a new message to this conversation via the Graph API and that the message will be displayed on the Teams application?
I tried to reply to this message via the graph API, but the reply message was sent to Outlook, not in the Microsoft Teams application.
It is now possible to send messages to personal chat(1:1) or to group chat in Microsoft Teams using Microsoft Graph API. And yes, the messages will be displayed in the Teams application using Microsoft Graph API.
Please refer the "1:1 and group chat messages" section from the below microsoft documentation link:
chatMessage resource type
Also, below is the graph API to send a message to any conversation you want using Post HTTP method :
https://graph.microsoft.com/beta/users/{user-id}/chats/{chat-id}/messages
To fetch {user-id} and {chat-id}, please follow the below steps using Get HTTP method:
Fetch the user id of a logged-in user or user id of other user using below graph API's:
https://graph.microsoft.com/v1.0/me
https://graph.microsoft.com/v1.0/users
Fetch the conversation/chat id of a user:
https://graph.microsoft.com/beta/me/chats
https://graph.microsoft.com/beta/users/{id}/chats
As of now, there is no graph API to reply to a personal chat but we can reply to any team's channel message using Microsoft Graph API.
The answer, for now, is no. The docs have stated
"In both the v1 and beta endpoints, the response of GET /users/id/messages includes the user's Microsoft Teams chats that occurred outside the scope of a team or channel. These chat messages have "IM" as their subject."
You may submit/vote an feature request in the UserVoice or just wait the update from the Product Team.
Here is a detailed explanation to answers that #parvin provided if you are trying to do this using Graph Explorer. There is one difference that in this method you don't need to have user-id anymore and chat-id would suffice. Simply Post HTTP method:
https://graph.microsoft.com/v1.0/chats/{chat-id}/messages
if you don't know how to get the chat-id, pleaser refer to answer provided by Parvin. Make sure your message is in the json format and you can put that in request body.
Then you can go to "Request headers" tab and add "Content-type" as Key and "application/json" as value.

Resources