如何检查添加 Google 文档评论的人的身份
How to check the identity of the person who added a Google Doc comment
我想创建一个插件来处理用户在 Google Docs 文档中添加的所有评论。我可以使用 Drive.Comments.list to get the list of all comments in the doc and Session.getEffectiveUser 获取用户的身份 运行 脚本。
我试过按电子邮件地址过滤。但是,Drive.Comments.list
的结果不包括 author.emailAddress。 Here is an example to show that displayName
is included. Here is an example that shows that emailAddress
is not included. The documentation 对于 emailAddress
确实说 This may not be present in certain contexts if the user has not made their email address visible to the requester.
但是,即使对于用户 运行 脚本添加的评论,emailAddress
也不存在。因此按电子邮件地址过滤不起作用。
然后我尝试按显示名称进行过滤。但是,Session.getEffectiveUser
不提供获取显示名称的方法。有没有其他方法可以获取用户的显示名称 运行 脚本?
试试 about.get 这个 returns 用户的电子邮件地址。
{
"kind": "drive#about",
"user": {
"kind": "drive#user",
"displayName": "Linda Lawton",
"photoLink": "https://lh3.googleusercontent.com/a-/AOh14GhroCYJp2P9xeYeYk1npchBPK-zbtTxzNQo0WAHI20=s64",
"me": true,
"permissionId": ddd88225573437243",
"emailAddress": "xxxxx@gmail.com"
},
我想创建一个插件来处理用户在 Google Docs 文档中添加的所有评论。我可以使用 Drive.Comments.list to get the list of all comments in the doc and Session.getEffectiveUser 获取用户的身份 运行 脚本。
我试过按电子邮件地址过滤。但是,Drive.Comments.list
的结果不包括 author.emailAddress。 Here is an example to show that displayName
is included. Here is an example that shows that emailAddress
is not included. The documentation 对于 emailAddress
确实说 This may not be present in certain contexts if the user has not made their email address visible to the requester.
但是,即使对于用户 运行 脚本添加的评论,emailAddress
也不存在。因此按电子邮件地址过滤不起作用。
然后我尝试按显示名称进行过滤。但是,Session.getEffectiveUser
不提供获取显示名称的方法。有没有其他方法可以获取用户的显示名称 运行 脚本?
试试 about.get 这个 returns 用户的电子邮件地址。
{
"kind": "drive#about",
"user": {
"kind": "drive#user",
"displayName": "Linda Lawton",
"photoLink": "https://lh3.googleusercontent.com/a-/AOh14GhroCYJp2P9xeYeYk1npchBPK-zbtTxzNQo0WAHI20=s64",
"me": true,
"permissionId": ddd88225573437243",
"emailAddress": "xxxxx@gmail.com"
},