Is it possible to retrieve the RFC 2822 (or any) headers from an email with the Outlook/Office 365 REST API? - outlook-restapi

An application I am working on needs access to the headers of an email - specifically ones like return-path, in-reply-to, and references. Ideally, we would love to be able to access all of the RFC 2822 headers of the email. Is this possible with the Outlook/Office 365 REST API? If not, is it possible with any API?

UPDATE: The InternetMessageHeaders property was added to the beta endpoint of the Outlook API, so you can get this without using the extended property stuff. You do have to request the property explicitly via $select though. Something like:
GET https://outlook.office.com/api/beta/me/mailfolders/inbox/messages?
$select=Subject,InternetMessageHeaders
For Graph: The property also exists on messages in the beta endpoint for Graph, so you can do:
GET https://graph.microsoft.com/beta/me/mailfolders/inbox/messages?
$select=subject,internetMessageHeaders
For non-beta endpoints: The API doesn't directly provide access. However, you can access the PidTagTransportMessageHeaders MAPI property using the Extended Property API.
From the first link, we see that the property ID for PidTagTransportMessageHeaders is 0x7D, and the type is String. So the $expand parameter of your GET would look like:
$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D')
NOTE: This is only applicable for the Outlook endpoint (https://outlook.office.com). For Graph, see the answer from madsheep
Putting that together with a GET for a specific message, your request might look like:
GET https://outlook.office.com/api/v2.0/me/messages/{message-id}?
$select=Subject,SingleValueExtendedProperties
&$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D')

To all the poor souls lost in the insanties of MS Graph api - the answer above doesn't seem to be correct anymore as it will return error "PropertyId is not a property name" - it seems the correct answer now is:
GET https://graph.microsoft.com/beta/me/messages/{message-id}?
$select=Subject,SingleValueExtendedProperties&
$expand=SingleValueExtendedProperties($filter=id eq 'String 0x7D')
This is how you get the message headers from the Outlook/Office 365 REST Graph api.

Related

How to pass a document's ID using Azure CosmoDB?

I am creating a simple CRUD app to learn Azure. I have created a logic app (standard model) and my APIs are designed using the workflow designer. I also have a CosmoDB to hold each object.
My GET API, that gets all the documents, looks like this:
And my GET API, that gets only one document, looks like this:
Here is what my CosmosDB looks like with the ID of the item that is successfully return when statically called:
So what do I need to replace the static ID with, in the *Document ID input so that I can pass in different IDs?
I have looked at the docs and it suggests documentId, but when I type this in I get this error:
Thanks!
Thank you #404 , posting your suggestion as an answer to help other community members.
" You should know the id you want to retrieve from the flow that feeds into the Get a document block (unless it's static). Since you only have a HTTP trigger your id should be supplied through that. As example by passing the id in the url as query parameter which you then refer to in your Document ID field."
Trigger a post request to logic app with Document ID in request body.
Try as below:

Microsoft Graph API transient user filter

Is there a way for me to get back ONLY users when I call List group transitive users in graph API?
The response I get has objects for groups as well as users EG:
{group: IT support},
{user: Kevin},
{user: Bob},
{user: Phil},
{group: Developers},
{user:phil}
Id like to be able to filter out the group objects but no dice. Has anyone been able to do this before? Thanks
Usually, we can use $filter query parameter to retrieve the response we need, but it seems that '#odata.type' is not supported to be a query param here. I will double confirm with Azure support engineer.
By the way, the response is in json format, you can write a filter yourself to get the user objects only.
Update:
I have got an response from the Azure support engineer, '#odata.type' is not supported to be a query param here. So you need to deal with the data by yourself.

Acumatica REST API - StockItem - how to expand Price Item in request

I am using the Acumatica REST endpoint https://sandbox.kimballinc.com/AcumaticaERP/entity/Default/6.00.001 in my application
I am using the URL https://sandbox.kimballinc.com/AcumaticaERP/entity/Default/6.00.001/StockItem?$filter=InventoryID eq '123456'&$expand=WarehouseDetails to fetch info about a Product and to get complete warehouse details
My query is how to expand and get Price/CostInfo details in the response
Expand should be used for the arrays declared inside the entity in the web service endpoint:
Price/CostInfo is not an array so it can't be expanded. The default endpoint doesn't contain those fields so you'll need to extend the endpoint and add them:
Select the StockItem entity and use POPULATE button to add the fields:
Extended endpoint requires that you specify a different endpoint name:
In this example I choose DefaultPlus so I need to connect to:
https://xyz/AcumaticaERP/entity/DefaultPlus/6.00.001/StockItem
Instead of:
https://xyz/AcumaticaERP/entity/Default/6.00.001/StockItem
The added fields will be part of the GET response for StockItem, no special parameter is required for that.
I took a look at your site and noticed that you are using Acumatica 2018 R2.
I would then recommend that you use the latest version of the endpoint 18.200.001 as there are more field there by default.
If I saw correctly some of the fields for the Price/Cost Info are already in the main entity as they have a relation 1:1 to it.
To resume it using the latest version of the endpoint would allow you to see these field without the need to expand anything.

using microsoft graph to get users by office location

I am trying to get all users in an office location using Microsoft Graph
I am receiving the following error message:
Unsupported or invalid query filter clause specified for property 'officeLocation' of resource 'User'.
I am using the following uri and filter:
https://graph.microsoft.com/v1.0/users?$filter=officeLocation eq '18/2107'
at the graph explorer here:
https://developer.microsoft.com/en-us/graph/graph-explorer
How can I pull all users for an Office Location?
Thanks!
Unfortunately this property on user is not filterable. If this is something important, please file a request for this on Uservoice: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis
Hope this helps,
Filter on officeLocation is not available till date, we can query for all user than can filter out from that based on officeLocation, API will not return all user in one call, Microsoft Graph will continue to return a reference to the next page of data in the #odata:nextLink property with each response until all pages of the result have been read.You can retrieve the next page of results by sending the URL value of the #odata:nextLink property to Microsoft Graph.

Detail of list without user authentication

I'm trying to get details of Foursquare list by PHP library:
$foursquare = new FoursquareAPI($key,$secret);
$list = $foursquare->GetPublic('lists/'.$listId);
But everytime gets this error:
string(7672) "{"meta":{"code":200,"errorType":"deprecated","errorDetail":"Please provide an API version to avoid future errors.See https:\/\/developer.foursquare.co ... "
When I debug it, library calls this URL: https://api.foursquare.com/v2/lists/ with these params: Array ( [client_id] => <client_id> [client_secret] => <client_secret> )
But when I try this API method in Foursquare API Explorer I see that, this URL is calling: OAuth token automatically added. https://api.foursquare.com/v2/lists/<list_id>?oauth_token=<token>&v=20111205.
In lists doc is Requires Acting User: No, so I'm confused. Is it possible to call this function without authenticating user?
It would be nice, because I want to add places from my list (favourite restaurants) to my page on Google map in Contacts. It would be useful for our clients.
The error you are seeing is unrelated to the list endpoint you are requesting or the state of authentication. It is a warning that the library you are using is currently not following versioning best practice for Foursquare. You can read more about it here.
As for the list there should be a response object at the same level as the meta object.

Resources