Gmail API .NET:获取完整消息 [英] Gmail API .NET: Get full message

查看:67
本文介绍了Gmail API .NET:获取完整消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何获取完整的消息,而不仅仅是使用gmail API的元数据?

How do I get the full message and not just the metadata using gmail api?

我有一个服务帐户,并且能够检索消息,但只能使用元数据,原始格式和最小格式.如何检索完整格式的完整消息?以下代码可以正常工作

I have a service account and I am able to retrieve a message but only in the metadata, raw and minimal formats. How do I retrieve the full message in the full format? The following code works fine

var request = service.Users.Messages.Get(userId, messageId);
request.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Metadata;
Message message = request.Execute();

但是,当我省略格式时(因此我使用默认格式为FULL),或者将格式更改为UsersResource.MessagesResource.GetRequest.FormatEnum.Full 我收到错误:Metadata scope doesn't allow format FULL

However, when I omit the format (hence I use the default format which is FULL) or I change the format to UsersResource.MessagesResource.GetRequest.FormatEnum.Full I get the error: Metadata scope doesn't allow format FULL

我包括以下范围:

https://www.googleapis.com/auth/gmail.readonly, 
https://www.googleapis.com/auth/gmail.metadata,
https://www.googleapis.com/auth/gmail.modify,
https://mail.google.com/

如何获取完整的消息?

推荐答案

我必须删除元数据的范围,以便能够获取完整的消息格式.

I had to remove the scope for the metadata to be able to get the full message format.

这篇关于Gmail API .NET:获取完整消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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