Add reaction to existing posts or comments - microsoft-graph-api

How can we "like" or add other reactions to someone else's channel message or comment via the Graph API?

I've not done this myself, but it certainly looks possible. You need to reply to the message, as per https://learn.microsoft.com/en-us/graph/api/channel-post-messagereply?view=graph-rest-1.0&tabs=http and notice that it has a "reactions" collection. That would be populated with a chatMessageReaction type, as per https://learn.microsoft.com/en-us/graph/api/resources/chatmessagereaction?view=graph-rest-beta
Note of warning: chatMessageReaction is a beta type though, so just be aware you need to call the beta endpoint, and it has a risk to use in production code as things might change.

Update: We reached out to MS Support and received the following info: "The API to reply to a message using a POST /replies request is solemnly for issuing a reply to a message, and not to edit the status of the parent message itself. Moreover, the "update chatMessage" API which is a PATCH /messages and which is the only API to edit a parent message only supports updating the policyViolation property of a chatMessage. Essentially, there is currently no documented API / already-present API examples on how to add a reaction, making this purely unsupported."

Related

How to forward an email and change the subject using the Microsoft Graph api

recently I ran into a problem where I was using python imap to automate outlook tasks, but microsft changed basic auth to Oauth now, and I have not being able to authenticate ever since, I get an error
imaplib.error: AUTHENTICATE failed.
So I started working with the Microsoft graph API, in which I can get the information that I need but once I need to forward an email I can't setup a custom subject, I can just add a comment and toRecepient custom arguments.
https://learn.microsoft.com/en-us/graph/api/message-forward?view=graph-rest-1.0&tabs=http
any advice here ?
If you use the Create-Forward endpoint https://learn.microsoft.com/en-us/graph/api/message-createforward that will create a draft message of the forward which you can then patch any message property you want to update and then send.
The one thing they don't mention in the documentation is you should set the Prefer: outlook.timezone header to make sure the dates in you response are set the local time of the responder.

Determining forwarded and replied to email messages in Microsoft Graph API

I'm building a .NET Core WEB API that serves as an automation layer over Outlook messages and calendars using the Microsoft Graph SDK. One of the requirements is to identify which messages have been replied to or have been forwarded.
It's not yet clear to me how I can determine whether an email message has been forwarded or replied to when using the results of Graph Explorer "My Mail" sample request.
This answer states that the ConversationId property remains the same (which is indeed the case) and that the only indication is either "FW:" or "RE:" prefixed to the subject. Also in the Message documentation I can't seem to find a proper, reliable way of identifying those.
Can anyone tell me how this can be done?
If your looking at mail in the Inbox and you want to know if they have been acted on by a Mail client (eg Oultook or OWA) then you could use PidTagLastVerbExecuted https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtaglastverbexecuted-canonical-property (this is how outlook determines it) eg
https://graph.microsoft.com/v1.0/me/messages?$expand=SingleValueExtendedProperties($filter=(Id%20eq%20'Integer%200x1081'))
If a Message had been replied to you would see a result like
"singleValueExtendedProperties": [
{
"id": "Integer 0x1081",
"value": "102"
}
]
This still isn't 100% reliable so if your doing this for Auditing the only way is using the Tracking Logs (MessageTrace in Office365)
Email, in general, has very weak support for message threading. That said, you might be able to pull this from the internetMessageHeaders collection.
Per RFC5322:
The In-Reply-To: and References: fields are used when creating a
reply to a message. They hold the message identifier of the original
message and the message identifiers of other messages (for example,
in the case of a reply to a message that was itself a reply). The
In-Reply-To: field may be used to identify the message (or
messages) to which the new message is a reply, while the
References: field may be used to identify a "thread" of
conversation.
Note that In-Reply-To is an optional field so it may not always be populated.

How to start using Delta function in Microsoft graph by skipping initial data

Microsoft recommends to use delta function in combination with Subscriptions/Notifications to synchronize mailbox. So my plan is:
Create subscription
Receive notification about new mail in inbox
Use delta function to get latest changes in the inbox
My mailbox already has several thousands of letters. If I run the query
https://graph.microsoft.com/v1.0/users/{id}/mailFolders/inbox/messages/delta
It will return in response #odata.nextLink with $skiptoken param many times and only after I get all the thousands of emails in my mailbox I will receive response with $deltatoken to track new changes.
Is there a way to get deltatoken after the first request? I don't want to synchronize the old messages. I want to skip all old messages in inbox and have a fresh start.
Today the delta query functionality does not support this scenario. To request new features please post ideas to uservoice
This is supported for some endpoints. You can use $deltaToken=latest to get just a deltaToken without any resource data. It's not, as far as I can tell, available for mailboxes… but who knows, maybe it will be soon.
This is not documented anywhere in the documentation for the specific APIs that do support it, but is instead documented in the Overview for change tracking. Why? Because Microsoft wants you to be sad all the time.

Microsoft Graph API for Education: error listing user schools

I'm trying to retrieve the educationShool list of an educationUser from Microsoft Graph per the API reference:
I am getting this error:
Error message: The request URI is not valid. Since the segment
'memberOf' refers to a collection, this must be the last segment in
the request URI or it must be followed by an function or action that
can be bound to it otherwise all intermediate segments must refer to a
single resource.
I have reproduced this issue in the Graph Explorer, if I try to send this request, I get the same error:
https://graph.microsoft.com/v1.0/education/me/schools
If I try to list the Classes (I think it should be a very similar scenario), it works ok:
https://graph.microsoft.com/v1.0/education/me/classes
Am I doing something wrong, or is this a bug in the API?
I was able to reproduce this and it looks like there may be a bug here. While that gets investigated, I can confirm that it works properly in the /beta release:
https://graph.microsoft.com/v1.0/education/me/schools
I'd suggest using /beta for this particular call if possible.
Update: This issue has been resolved and education/{users}/schools should now be working in both v1.0 and Beta versions.

patch request to microsoft graph api for planner task does not return the updated task in the response

According to the documentation on updating order hints in planner.
The client can obtain the values immediate if return=representation preference is specified in the PATCH requests.
I've tried putting this in the header, and as a query parameter, but I still only get back a 204 response.
Where in the PATCH request, does the return=representation go ?
Just as you can see in the docs:
Important: APIs under the /beta version in Microsoft Graph are in
preview and are subject to change. Use of these APIs in production
applications is not supported.
The API is still in development. So the documentation may update too.
You can submit an issue to the Github issue list first. Meanwhile vote up the existing request or submit a new one in the UserVoice
The graph sdk team enlightened me.
The header Prefer:return=representation is what needs to be set.

Resources