A lot of you use Gmail commands to show the number of unread emails in your app’s UI to let users know about new messages. So, starting with 4D 20 R7, we’ve upgraded Google.mail.getLabelList() function so that it can get the number of unread emails along with label properties for Gmail all at once to ensure optimal response times.
Gmail labels
To optimize the response time, the .getLabelList() function lets you get the total number of messages and unread messages, as well as the total number of threads and unread threads for multiple labels in one call. It now takes an object with 2 possible attributes to get this info:
- Use the withCounters attribute to get the message and thread counters along with the standard label info:
$labelList:=$google.mail.getLabelList({withCounters: True})
- Use the ids collection to specify which label you want to get. If you use the ids attribute, the message and thread counters are always returned:
// If you want to get only the INBOX and SENT information:
$myLabels:=$google.mail.getLabelList({ids: ["INBOX";"SENT"]})
These enhancements make it easier for you to keep your users informed about their unread emails by providing all the necessary information in a single call. And as it is done in a single call, response times are optimal compared to what was possible before. This same improvement has also been applied to IMAP, allowing you to retrieve unread email counts and mailbox properties in a single call for optimal performance.
If you need further information, please consult the 4D Netkit documentation.