Working with Gmail Contacts
Aspose.Email supports working with Gmail contacts. Using the IGmailClient interface, users can retrieve contacts from a Gmail account, create new contacts, and update as well as delete existing contacts. Gmail allows developers to perform all these using its public developer’s API. The following user information is required for working with Gmail contacts: User name, email address, password, client ID, client secret refresh token. This article shows how to:
- Access Gmail contacts.
- Create new Gmail contacts.
- Update existing contacts.
- Delete a contact.
- Save contact.
Access Gmail Contacts
The following is a sample application which can be used to access the detail of contacts in all the groups.
Creating Contact
The following code snippet shows you how to create a contact.
Updating Contact
Once a contact is retrieved, its attributes can be updated and the contact can be saved back to the Gmail account. The following code snippet shows you how to retrieve contacts from a Gmail account and then modify one of these which is then saved back.
Deleting Contact
In order to delete a Gmail contact, the Gmail client DeleteContact method is used as shown in the following sample snippet.
Saving Contact
Aspose.Email allows saving contacts to various output formats such as MSG and VCF. The Save method provides the capability to achieve this. The following code snippet shows you how to save a contact.