如何从Gmail API获取UserProfile?

时间:2021-09-14 15:24:58

I want to get current state of users mailbox (HistoryId) so that any new mails after that state are synced.

我想获取当前状态的用户邮箱(HistoryId),以便同步该状态之后的所有新邮件。

As per Google API this tried it over their it returns following fields

根据谷歌API,它尝试了它返回以下字段

{
  "emailAddress": string,
  "messagesTotal": integer,
  "threadsTotal": integer,
  "historyId": unsigned long
}

As my code is in java i tried it their but it returns only the userId

由于我的代码在java中,我尝试了它们但它只返回userId

Code :

service.users().getProfile(user);

service is the Gmail authenticated service object and user is userId

service是经过Gmail身份验证的服务对象,user是userId

API reference : =>

API参考:=>

Any help appreciated!!

任何帮助赞赏!!

1 个解决方案

#1


0  

Please try the following to retrieve all the information as specified above:

请尝试以下方法检索上面指定的所有信息:

Once you have imported this class reference:

导入此类引用后:

com.google.api.services.gmail.model.Profile

Then it exposes the following methods when you instantiate the object. I would think it is something in the line of (incomplete code - only indication):

然后,它在实例化对象时公开以下方法。我认为这是(不完整的代码 - 仅指示)的一部分:

Profile.getEmailAddress();

Profile.getMessagesTotal(); 
Profile.getThreadsTotal(); 
Profile.getHistoryId();

Gmail Profile class

Gmail个人资料类

#1


0  

Please try the following to retrieve all the information as specified above:

请尝试以下方法检索上面指定的所有信息:

Once you have imported this class reference:

导入此类引用后:

com.google.api.services.gmail.model.Profile

Then it exposes the following methods when you instantiate the object. I would think it is something in the line of (incomplete code - only indication):

然后,它在实例化对象时公开以下方法。我认为这是(不完整的代码 - 仅指示)的一部分:

Profile.getEmailAddress();

Profile.getMessagesTotal(); 
Profile.getThreadsTotal(); 
Profile.getHistoryId();

Gmail Profile class

Gmail个人资料类