How to open a draft created with Gmail API in browser?

后端 未结 2 904
南笙
南笙 2021-01-28 20:44

Im trying to create a gmail draft using gmail API and open it in a new tab.

When i try to open a draft using the following url : https://mail.google.com

相关标签:
2条回答
  • 2021-01-28 21:13

    Your goal:

    To be able to open a browser tab directly focused on a specific draft of your choosing, from the drafts in your mailbox. (Correct me if I'm wrong).

    Background:

    1. You noticed that drafts have a "compose" parameter visible in the url when focused within the UI.
    2. The drafts resource doesn't include the "compose" parameter, so we can't get it from the API, and it also isn't equal to the draft id.

    Conclusion:

    Since the parameter needed is not publicly available via API, you can't achieve your goal at the moment. You can request the feature to Google directly by creating a "Feature Request" for the Gmail API. Here's the link Issue Tracker.

    0 讨论(0)
  • 2021-01-28 21:16

    The way to make this url changed, now it works like this:

    mail.google.com/mail/#inbox?compose=draft.message.id

    If you list your drafts you get

    {
      "drafts": [
        {
          "id": "r5632827412362757569",
          "message": {
            "id": "174f4fa0dd96af123",
            "threadId": "174f4f59344d6321"
          }
        }
      ],
      ...
    }
    

    So, to open this draft you need the following url :

    mail.google.com/mail/#inbox?compose=174f4fa0dd96af123

    0 讨论(0)
提交回复
热议问题