How to create a sub label with Gmail REST API

ぃ、小莉子 提交于 2019-12-06 05:20:23

You need to make two API calls. The first to create the top level label, the 2nd to create the child label. Once both labels exist, Gmail UI will properly collapse the label hierarchy.

this is using python, and using MakeLabel and CreateLabel from here https://developers.google.com/gmail/api/v1/reference/users/labels/create

this is easy!..

if papa_label_dont_exists:
    gmail_label_obj  = MakeLabel('Father')
    label            = CreateLabel(service, "me", gmail_label_obj)

gmail_label_obj  = MakeLabel('Father/Son')
label            = CreateLabel(service, "me", gmail_label_obj)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!