Add custom headers and retrieive custom header using Microsoft Graph API

回眸只為那壹抹淺笑 提交于 2020-01-05 09:05:20

问题


I am currently using Microsoft Graph API to retrieve my email, send new email and answer to an email.

I use Code Grant authorization to identify my user and access its information.

PROBLEM

This application let the user send email to our customers that have unpaid invoice. But the application uses GET https://graph.microsoft.com/v1.0/me/messages (with $search set to the customer email) to retrieve every mail that involves the customer, so the user can trace every conversation made by other employees.

The problem is to be able to differentiate emails (sent from our app) from others mails (sent from Outlook app). We would like to use email headers, which are accepted by a large amount of mail servers, and with which we could filter the search result to inform the user which email comes from our app.

The desired outcome would be that for example, I could be able to call Microsoft Graph API like so :

  1. GET https://graph.microsoft.com/v1.0/me/messages with OData Parameters : $search="john.doe@gmail.com" and $select=subject,bodyPreviewreceivedDateTime,headers
  2. Then asuming the request has send back a 200 code the JSON output would be :

Notice the X-MY-COMPANY-INVOICE, which would be the ultimate goal for us to let the app be aware this was sent from our app and not from Outlook app.

QUESTION

Is there any way to perform this using Microsoft Graph API? If not, does Microsoft plan to release this feature any soon?

QUESTION 2

I am opened to suggestion, is this the best way to do this or am I going right on the wall with this technique? If yes, what would be the best way to overcome this issue?


回答1:


This is a good use case for Extensions. You can use these mechanisms to attach custom data to an element (messages, events, users, groups, etc.).

There are several types of extensions available with Microsoft Graph: Extended Properties, Open Extensions or Schema Extension. Each has it's own set of constraints so it is worth reviewing each to determine which works best for your scenario and architecture. That said, based on your description, I suspect Schema Extensions may be the best fit here.



来源:https://stackoverflow.com/questions/47711529/add-custom-headers-and-retrieive-custom-header-using-microsoft-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!