Determining forwarded and replied to email messages in Microsoft Graph API - 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.

Related

MQTT publisher of message

I'm trying to run an MQTT broker and I want to store the published data, but I need to know which user sent the message so I can store payload for each user and study them later. The problem is when two different user try to publish message on same topic I can not tell whose data it is. Is there a way to figure out the publisher of a message? I'm using Mosquitto btw.
Short answer, you don't.
MQTT messages do not contain any information about the user or client that sent it, unless you choose to encode it in the message (as part of the payload for v3.x or alternatively in the header properties for v5.0)
Longer answer:
Some MQTT brokers have plugin APIs that may allow you access to more meta data for a message. You may be able to write a plugin that will take the message + the meta data and then store them. Last time I looked, mosquitto's plugin API was only for writing authentication plugins, and did not give access to the messages themselves. But a different broker may allow this.

Add reaction to existing posts or comments

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."

Is it possible to show only certain messages to users in MQTT topics?

My goal is to extend an HTTPS REST API platform with an MQTT bus. I am trying to figure out what the best way is to go about this.
Topic Example:
I have an HTTPS REST API that contains the following end-points.
1) /files/{fileId}
2) /files
If I want to restrict users based on fileId's, it is easy for topic 1. If somebody is allowed to see this file, they can subscribe, otherwise they can not.
Now my question is about the second topic. Would it be possible, to publish to /files but only show subscribers the data they are allowed to see?
Message Example:
I publish these messages to /files
{
"fileName": "Test.txt",
"fileId": 123456,
"Author": "Bert",
"Content": "Hello World"
}
------
{
"fileName": "Test2.txt",
"fileId": 654321,
"Author": "Hank",
"Content": "Foo Bar"
}
Bert and Hank are both subscribed to /files but they are only allowed to see their own files (Bert = 123456, Hank = 654321).
UPDATE:
In this artice the topic starts with myhome etc. This might be the same example as above. If I publish to myhome, how can I know it is only this user when I have multiple users.
The ACL schemes for MQTT tend to be based purely username and access to a topic (or wildcard topic).
Messages are published to a topic, there is no way to specify anything more (e.g. username or client id).
Having to do message payload inspection to determine if a subscriber is able to see a specific message would have a huge impact on performance. Also as there is no prescribed message payload format (you can send any byte array payload) coming up with a way to specify a which parts of the message to filter on would be difficult.
You may be able to implement something like this by modifying a open source brokers, but I doubt it would be easy.
Your example looks very convoluted. Maybe we have an XY-problem case here. You seem to want to [ab]use a public-subscriber mechanism as a point-to-point mechanism over a non-secure (broadcast) network, like a WiFi without encryption or an ethernet without switches but hubs instead.
In that case you may want to use endpoints as topics (networknode{1, 2, ...}), to address individual computers, and if the answers are not to be seen by everyone, you will have to encrypt them. And you then need a mechanism for distributing the keys.
Or maybe you just want to use plain HTTPS. MQTT has been a huge step forward for the IoT world, but it is not the panacea.
On the other hand, why is the file ID not part of the topic?

tsung jabber/xmpp request message to a single node

i would like to send XMPP-Messages to specific XMPP-User. Unfortunately the tsung request "jabber" with typ "chat" only allows broadcast messages to all online users (see below).
<request><jabber type="chat" ack="no_ack" size="16" destination="online"/></request>
Is there a way to send XMPP-Messages to a single user?
Thanks for your help
Documentation seems to indicate that it does support XMPP messages to single user.
I haven't found any documentation about message types, but there is a source code, which also indicates that multiple ways of addressing users are available. I don't want to mislead you about particular types, just read the code.

check email existence using Delphi with Indy or any other components/tools for Delphi

I need to check email accounts whether exists or not, I need to do that using Delphi and Indy (if possible)
I have a windows database for ERP system and I need to make sure that the customer enter valid email into the system so I can send to my customer the quotes they request.
I tried to test on yahoo and google using send commands HELO, MAIL and RCPT but no success.
Mail servers have to protect themselves against spammers and others with malicious intent. They are not going to give up their secrets easily. It is common for mail servers to be configured to black hole messages sent to non-existent recipients. They don't respond to the sender saying, "sorry, that user doesn't exist, please try again."
So, if you want to verify whether or not an e-mail address has a human behind it I think the only way to be sure is to send an e-mail requesting a response.
You have to ask your customers to confirm their email address, i.e. entering it twice to reduce misspellings, asking to register and sending an activation link and so on. State explicitly they need a valid email address: if they're asking you a quote why should they enter an invalid address? But be aware some people may use disposable email addresses to protect their real ones.
You have no way to check if an address really exists just asking its server. Due to the large amount of spam and techniques implemented by spammer to harvest and clean their addresses lists, most servers are setup to defend themselves.
That's why I suggested to "be polite". I am sorry if you got it the wrong way, I was just telling you that if your application shows a "spammer-like" behaviour (and your previous version of the question was much unclearer about your aims), it can lead to your IPs being blacklisted. Then you can have much more troubles to send quotes to customers.
You may try ICS components, an open source library with good examples (see SMTPClient).
So this library or another one will not tell you if an email account exists or not because it's depending on the way the host answer to the commands about a non existent account.
In ICS, when the command have been sent you may have to manage an event : SmtpRequestDone(Sender: TObject; RqType: TSmtpRequest;ErrorCode: Word);
Where ErrorCode is the Error code (ie 550).

Resources