Contacten beheren in Microsoft Graph
Contents
[
Hide
]
Zie Azure AD‑configuratie en Microsoft Graph‑authenticatie artikel om te leren hoe je jouw applicatie integreert met Microsoft Graph.
Aspose.Email for Java biedt ondersteuning voor het beheren van contacten via Microsoft Graph. Je kunt contacten opsommen, ophalen, aanmaken en bijwerken direct vanuit contactmappen.
Het onderstaande code‑voorbeeld toont hoe contactitems beheerd kunnen worden met de volgende methoden van de bibliotheek:
listContacts(String id)— Haalt een verzameling contacten op uit de opgegeven map.fetchContact(String id)— Haalt een contact op op basis van de ID.createContact(String folderId, MapiContact contact)— Maakt een nieuw contact aan in een map.updateContact(MapiContact contact)— Werkt een bestaand contact bij.
IGraphClient graphClient = null;
// List Contacts
MapiContactCollection contacts = graphClient.listContacts("contactFolderId");
// Fetch Contact
MapiContact contact = graphClient.fetchContact("contactId");
// Create Contact
MapiContact newContact = new MapiContact("Jane Smith", "jane.smith@example.com", "XYZ Corporation", "777-888-999");
MapiContact createdContact = graphClient.createContact("contactFolderId", newContact);
// Update Contact
createdContact.getTelephones().setPrimaryTelephoneNumber("888-888-999");
MapiContact updatedContact = graphClient.updateContact(createdContact);