如何使用Gmail REST API创建子标签 [英] How to create a sub label with Gmail REST API

查看:64
本文介绍了如何使用Gmail REST API创建子标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Gmail REST API创建标签(使用我自己的代码,而不是库).我可以将其用于顶层标签,但现在我想为顶层标签创建一个子标签.我注意到,当我使用Gmail创建子标签时,然后查看通过REST API收到的列表,子标签以'/'字符作为分隔符显示,例如顶部标签/子标签".但是,当我尝试创建这样的标签时,我只会得到名称中带有斜杠的标签,而不是实际的子标签.我该怎么办?

I am using the Gmail REST API to create a label (using my own code, not a library). I have it working fine for a top level label, but now I want to create a sub label to the top label. I noticed that when I create a sub label using Gmail, then look at the list I receive via the REST API, sub labels are shown using the '/' character as a delimiter, e.g. "Top Label/Sub Label". However when I try to create a label like this, I just get a label that has the slash in the name, not an actual sub label. How can I do this?

推荐答案

您需要进行两次API调用.第一个创建顶层标签,第二个创建子标签.两个标签同时存在后,Gmail UI将正确折叠标签层次结构.

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.

这篇关于如何使用Gmail REST API创建子标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆