Different CalendarID between Outlook.MAPIFolder and the Office 365 API - microsoft-graph-api

Currently, I use Microsoft.Office.Interop.Outlook.MAPIFolder in Outlook app, and use this API https://outlook.office365.com/api/v2.0/me/calendars in Office 365 api to get CalendarID.
But there is different CalendarID in result. Why did have this difference?

These are different API's eg one is MAPI and one is REST so they have different Id formats. You can use the Graph API (or EWS) to translate the Id between formats https://learn.microsoft.com/en-us/graph/api/user-translateexchangeids?view=graph-rest-1.0&tabs=http . You could also just get the PR_EntryId extended property https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/extended-properties-rest-operations using the REST API which should match whatever CalendarId you getting from MAPI.

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

Microsoft Graph API, Get SharePoint Site Admin/Members

Trying to use Microsoft's Graph API to iterate through Sharepoint sites, in order to find and remove a user's access to sites when they go out of the country.
Graph / Sharepoint API documentation: https://learn.microsoft.com/en-us/graph/api/resources/site?view=graph-rest-1.0
I get a list of all sites using the Get Sites endpoint:
https://graph.microsoft.com/v1.0/sites
I then filter out personal / OneDrive sites, and try to use the List Site Permissions endpoint to try to get admins/members: https://learn.microsoft.com/en-us/graph/api/site-list-permissions?view=graph-rest-beta&tabs=http
Unfortunately, I get an empty value array in response for all sites:
{'#odata.context': "https://graph.microsoft.com/v1.0/$metadata#sites('<domain>.sharepoint.com%asdfasdgsdf-ca8f-4ec1-bb3e-sdfsdfsdgsdf%2Cbed949c3-3f83-47c2-a263-sdfsdfsdgasdf')/permissions", 'value': []}
I know that the query is fine, because if I change it to instead hit the Site Lists endpoint, I get a response which includes various values:
{'#odata.context': "https://graph.microsoft.com/v1.0/$metadata#sites('<domain>.sharepoint.com%sdfsdfsdgsd-7dce-4564-9de8-eb2dfc02eb86%sdfsdgsdfsdf-ab8c-464f-a77d-sdfsdfsdgsdg')/lists", 'value': [{'#odata.etag': '"sfwsdgsdg-aff1-4295-8443-sdfsdgasdf,7"', 'createdDateTime': '2020-08-26T16:17:41Z', 'description': 'This library contains items that have been modified or deleted but must remain available due to eDiscovery holds. Items cannot be modified...
...
So, the Site ID I am passing to the permissions request must be correct. Is this the wrong endpoint then? Or, is this functionality missing from the Graph API, and my only solution is via the SP Powershell module?
I have tried with both the v1.0 and beta vesions of the API.
Thanks!
According this it looks like a bug in Graph API.

Using MS Graph API is it possible to just list the email attachments without downloading the its content?

We're using MS Graph API to get the list of emails from an Outlook 365 mailbox. We have a requirement to list the attachments in every email.
When using the List Attachments endpoint of the Graph API, the contentBytes attribute value in the response contains the entire Base64 encoded attachment content. This increases the response size significantly. We have no need to access or store the attachment content.
https://learn.microsoft.com/en-us/graph/api/message-list-attachments?view=graph-rest-1.0&tabs=http#example
Is there a way in MS Graph API to just get the attachment file name(s) and IDs for one or more email messages?
Yes, you can use the same /attachments endpoint and get only the id and name of attachment using the $select query parameter.
Simply use the query
https://graph.microsoft.com/v1.0/me/messages/{messageid}/attachments?$select=id,name
Result:
You can always test graph calls in Graph Explore.

Search result on bases of file name using Microsoft graph api

I am using Microsoft Graph API for OneDrive (personal and business) integration. I am able to get content using the Search API but it is not returning the results expected per the documentation.
I have also compared response using Microsoft Graph Explorer with same request.
I am using these api requests:
GET /me/drive/search(q='doc') when searching on root.
GET /me/drive/root:/{item-path}:/search(q='{search-text}') when searching on non-root folder
These calls are not returning all of the files I would expect. I am not able to files which are 0 byte (empty).
search not return specific type of files, like .png, .jpg,.md,.js, maybe even more. for my testing, it will return .pdf, docx, odp and xls

Getting direct messages using Twitter REST api

I'm experimenting with twitter REST API with Ruby on Rails.
I'm using twitter gem for the same. I could get the client object using in my code.
client = current_domain.twitter_accounts.first.client
following the documentation given here
The client object works fine. But I couldn't get DirectMessages in the same way.
Also followed this documentation. Here I could not find a way to get DirectMessages. Is there a way in REST API to get twitter direct messages. Or do I need to implement Streaming API.
http://www.rubydoc.info/gems/twitter/Twitter/REST/Client
Methods included from DirectMessages
#create_direct_message, #destroy_direct_message, #direct_message, #direct_messages, #direct_messages_received, #direct_messages_sent
These map to the REST API endpoints
https://dev.twitter.com/rest/reference/get/direct_messages
https://dev.twitter.com/rest/reference/get/direct_messages/sent
n.b. you won't get group messages through this API and will need to rebuild an inbox model e.g. sequence replies of replies between yourself and the recipient.

Resources