Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
Show all 6 items in the list
Tags used for linking issues. [ID: 1172495]
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Description
I'm using the Google.Apis.Gmail.v1 NuGet package in my .NET application to subscribe to Gmail notifications of user's mailboxes they've given my app permission to read and edit. I request access to the user's mailbox by specifying the scopes:
I've setup a Google PubSub topic in my Google Cloud Console, and I've configured Gmail notifications to be published on a specific Topic. This is working fine. When a user authenticates my app using OAuth 2, after I've exchanged the code for an access token, I use the Gmail API to add a watch on the user's mailbox. This is also working fine.
However, when I receive an event from the specified Topic, I receive an email address and a historyId. When I request the history list with the received ID, I never (actually: NEVER) receive a history entry containing an actual value for the MessagesAdded property. It is always NULL. Sometimes I get a history entry with just one message in the 'Messages' property, but never in the 'MessagesAdded' property. Therefore I can not explicitly determine when the user received an email message. I've tried re-authorizing the application by the user's email account, but that doesn't work. The result is always the same, even though the documentation states that I should NOT use the Messages property, but one of the event-specific lists (like MessagesAdded or MessagesDeleted).
How am I supposed to determine when the user receives an email message? I am only interested in retrieving received messages one at a time, I am not interested in keeping an explicit list of synchronized messages.
Output
An example of the history.list responses I mostly get:
{ "History": [ { "Id": 7569705, "LabelsAdded": null, "LabelsRemoved": null, "Messages": [ { "HistoryId": null, "Id": "191d7c452d92dc7e", "InternalDate": null, "LabelIds": null, "Payload": null, "Raw": null, "SizeEstimate": null, "Snippet": null, "ThreadId": "191d7c452d92dc7e", "ETag": null } ], "MessagesAdded": null, "MessagesDeleted": null, "ETag": null } ], "HistoryId": 7569711, "NextPageToken": null, "ETag": null }
Steps