首页 > 解决方案 > 使用 Google Drive API 在 Google Doc 上获取评论:评论所有者的 EmalAddress 返回 null

问题描述

我有以下代码来获取对给定 Google Doc 的评论。对于Fields,我提供了*检索所有信息的值。我可以正确检索该Author.DisplayName值,但Author.EmailAddress始终是null. 我想知道这是否是正常行为。我怎样才能减轻这种情况?

public IList<Comment> RetrieveComments(string fileId)
{
    var _driveService = GetDriveServiceInstance();

    try
    {

        CommentsResource.ListRequest commentRequest = _driveService.Comments.List(fileId);
        commentRequest.Fields = "*";

        CommentList comments = commentRequest.Execute();

        return comments.Comments;
    }
    catch (Exception e)
    {
        Console.WriteLine("An error occurred: " + e.Message);
    }
    return null;
}

标签: c#google-drive-apigoogle-docs

解决方案


该字段EmailAddress未填充Comments

作者

嵌套对象

评论的作者。不会填充作者的电子邮件地址和权限 ID。


推荐阅读