Graph API - can one retrieve MIME/EML for an Event? - microsoft-graph-api

I am creating Events using the Microsoft Graph API (actually using the C# SDK).
I would like to download the raw 'eml' of the invitation messages.
This seems trivial with Messages:
Download .eml file with Microsoft Graph C#
...and so I've tried to adapt this to Events but with no luck - when I try:
https://graph.microsoft.com:443/v1.0/users/{user-id}/calendar/events/{event-id}/$value
I get ErrorInvalidRequest: The OData request is not supported.
It feels as though this should be possible - an Event invitation is just an email message with an additional ICS attachment... any ideas where I'm going wrong?

Related

Microsoft purview API call

I'm looking to integrate Microsoft's Purview DLP in my web application. My application sends email so I want to block any sensible information from being sent.
Basically a user is going to be under a Microsoft Purview policy to prevent data losses. I want to integrate his DLP policy within my web application.
My two main question were: Is there an Api call that can retrieve then sensitivity label of a certain document of a user? And is there an Api call that can scan a document or string with the regex expression of Microsoft Purview?
Example: Let's say I want to send an email with a document, I want to see through an Graph Api call if we can retrieve the sensitivity label of Microsoft Purview of a certain document linked to a specific user. Then I want to scan the email content and the document content with Microsoft's Purview regex expression to see if there's any sensible information within the email. Ideally scanning the data would be an Graph Api call with a string containing the document and email content and then getting the response from the Api if the email can be sent or not.
Is there a way to do this? All the documentation I found was pretty basic and wasn't answering my questions.
To get the sensitive label through the API:
GET /users/{usersId}/security/informationProtection/sensitivityLabels/{sensitivityLabelId}
or
GET /me/security/informationProtection/sensitivityLabels/{sensitivityLabelId}
For more info:https://learn.microsoft.com/en-us/graph/api/security-sensitivitylabel-get?view=graph-rest-beta#http-request

How to download attachments from every email in a mailbox in MS-graph w/ java?

I've been looking in vain for an example of this. Basically, we have a vendor that emails us files and I'm writing something that will occasionally get all the emails from the mailbox, download all the attachments, and then delete them.
But I haven't found an example of how to fetch all the emails in Java. Trying to reverse engineer from this answer
How to download attachments using Microsoft Graph API?
hasn't gotten me anywhere.
graphClient.users(mailboxAddress()). ??not sure where to go from here??

How can I download a OneDrive file with Office365 REST API into a Ruby variable?

I'm building a Ruby on Rails app, and I'd like to integrate some Office365 features.
For instance : I would like to download a file from OneDrive and then attach it to an Email in order to send it via Outlook rest API.
I found this get Item content OneDrive REST API but I dont understand how to use it.
I understand that I have to send a GET request (formated as explained in msdn.microsoft.com) with Rails, which will then provide me a "a pre-authenticated download URL" to download the file.
Then I will have to send a second GET request with this a pre-authenticated download URL to start the download, but I don't understand how to deal with the Response in order to save the file into a variable.
How can I retrieve the file into a variable of my Ruby on Rails App, so that I can attach it to an Email with an Outlook REST API to send it from my own Rail controller ?
Also this workflow is really not optimized in term of Bandwidth and Processing (3 REST API request + 1 download + 1 upload), it will work.
However if it exist a single REST API that direclty attach a OneDrive file to an email to send it, that would ease a lot my life, save energy, save money from Microsoft datacenter, and spare the planet ecology.
Any tutorial, examples, or more explanatory doc would be much appreciated.
--- EDIT ---
Adding link to the email is not wished as the email may have to be send to someone outside of Office365 users, and public link are a security issue for confidential documents.
Any help is welcome.
There isn't a single REST API call you can make currently to do what you want, although being able to easily attach a file from OneDrive to a new email message is a great scenario for Microsoft Graph API, it just isn't supported right now.
If you want to attach the file, you need to do as you mentioned, download the contents of the file, and then upload it again as an attachment to the message.
However, I'd recommend sending a link to the file instead, even though you mentioned you don't want to do that. OneDrive for Business now supports "company shareable links" which are scoped to just the user's organization instead of being available totally anonymously.
Something else to consider: The security concerns of sending an anonymous link aren't that different than sending an attached file. In fact, the anonymous link can be more secure, because access to the file can be monitored and revoked in the future (unlike the attachment, which will always be out there).

Mailcore retrieving folders and compose functionality

I am using Mailcore (https://github.com/MailCore/mailcore2) for accessing IMAP mail.
I could able to get all the inbox mails using this sample given. I able to retrieve all the mail folders as well. I want to implement compose functionality using this. I am not getting API details or samples for this. Could someone please help me ?
IMAP is an email retrieval protocol, it is not used for sending. For that, you have SMTP. So you were probably just looking in the wrong place...
I've never used mailcore2, but after reviewing their wiki pages, I found their example for composing and sending messages using STMP here.

Wall on FaceBook

i would like to post a message on facebook wall (standard friend/group's wall) not the Apps. using delphi, i could log-in but i dont know how to post a message on it. any suggestion?
I have never used Delphi so im not sure about the language structure
but facebook API is basically HTTP Requests, you should be able to build a class that upon instanation you would authorize your app and then have a set of methods that publish data via HTTPRequest and validate the response
Heres something you may wish to look at:
Facebook emailer in delphi via CakeMail: http://www.facebook.com/note.php?note_id=17522112271
And how to post via HTTP:
http://developers.facebook.com/docs/reference/api/post
It is possible.
If you're able to login you can use a sniffer to take a look for the details of how it is accomplished by Facebook itself when you do it withing a browser (kind of reverse engineering). Wireshark is the best tool for me.
Look and take your time to understand what's going on between your browser and the servers when you post messages to your friend's wall.
Once you understand the details, you can mimic the exact same behavior from your Delphi program to get the same results, for example with the TidHTTP or TidTCP components.
Facebook is AJAX intensive: series of HTTP GET/POST operations without full page refreshes.
Don't forget you're mimicking a undocumented and internal communication mechanism. Facebook or any other target site may change it's internal's and broke your program compatibility anytime.
Remember this kind of program may be prohibited... read the facebook agreement's for further details.
delphibook is a Delphi library to support Facebook applications.
Two possible links that may provide some guidance? They are not in delphi, but I assume the api would be similar to javascript/php ?
http://daipratt.co.uk/using-fb-api-to-make-a-full-post-to-a-users-wall/
http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/

Resources