Generating a link to an "Advanced Query Search"

Thomas Bergheim 1 Reputation point
2022-02-03T15:41:45.91+00:00

Hello,

I asked this in the outlook forum first, but apparently it is not possible without using Graph API, so I was redirected here.

I would like to be able to generate a link to a search, so for instance in your inbox (https://outlook.office.com/mail/), if you want to search for "test", I could do that directly by just accessing something like https://outlook.office.com/mail/?query=test.

Now this is done by an ajax POST request (which is a bit weird to be honest). I have searched around a lot but could not find anything helpful.

Also: how do you generate deeplinks? I can get the "Message-Id" field, but that is not enough to generate a direct link to an email, because your ID is constructed different. If I go to Three dots -> view -> Open in new window, the URL will be something like https://outlook.office.com/mail/id/AAasdfasdfasQkADIwOGI0YLTdhNjgtNDQg3MWasdfasdfgAQAJFCmCnasdfadsfgysaLw0ZQ%3D. How do I generate this ID? (I am using IMAP, so I can use the msgid)

Thanks.

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,881 Reputation points
    2022-02-04T06:39:27.947+00:00

    Hi @Thomas Bergheim , Microsoft Graph API supports getting messages from logged in user mailboxes by requesting GET /me/messages or
    GET /users/{id | userPrincipalName}/messages endpoint. Also supports optional query parameters.

    Here is the documentation for your reference.

    After the request, the return value contains the message id and weblink.
    171262-image.png

    171216-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.