Class Contact
- All Implemented Interfaces:
ICreatable,IUpdatable
The Contact resource represents an entry in a user's personal contact folder. Contacts store information about people and organizations including names, email addresses, phone numbers, physical addresses, and other personal details.
Contacts support:
- Multiple email addresses, phone numbers, and physical addresses
- Personal information (birthday, anniversary, children, etc.)
- Professional information (job title, company, manager, etc.)
- Social information (IM addresses, websites, nicknames)
- Notes and custom categorization
- Integration with contact folders
Example usage:
GraphClient client = new GraphClient();
// ... configure authentication ...
// Create a new contact
Contact contact = new Contact();
contact.setGivenName("John");
contact.setSurname("Doe");
contact.setDisplayName("John Doe");
contact.setJobTitle("Software Engineer");
contact.setCompanyName("Contoso Ltd.");
// Add email address
EmailAddress email = new EmailAddress();
email.setAddress("john.doe@example.com");
email.setName("John Doe");
contact.getEmailAddresses().add(email);
// Add phone number
Phone phone = new Phone();
phone.setNumber("+1-555-0123");
phone.setType(PhoneType.MOBILE);
contact.getPhones().add(phone);
// Create the contact
Contact createdContact = client.createContact(contact);
- Since:
- 1.0
- See Also:
- contact resource type, Create contact, Update contact
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFlag()getId()getTitle()voidsetAssistantName(String assistantName)voidsetCompanyName(String companyName)voidsetDepartment(String department)voidsetDisplayName(String displayName)voidvoidsetFlag(FollowupFlag flag)voidvoidsetGeneration(String generation)voidsetGivenName(String givenName)voidvoidvoidsetInitials(String initials)voidsetJobTitle(String jobTitle)voidsetManager(String manager)voidsetMiddleName(String middleName)voidsetNickName(String nickName)voidsetOfficeLocation(String officeLocation)voidsetParentFolderId(String parentFolderId)voidsetPersonalNotes(String personalNotes)voidsetProfession(String profession)voidsetSpouseName(String spouseName)voidsetSurname(String surname)voidvoidsetWeddingAnniversary(String weddingAnniversary)voidsetYomiCompanyName(String yomiCompanyName)voidsetYomiGivenName(String yomiGivenName)voidsetYomiSurname(String yomiSurname)Converts this object to its JSON representation for creation.toString()Converts this object to its JSON representation for update.toUpdateJson(List<String> propertyNames)Converts this object to JSON for update with specific properties.
-
Constructor Details
-
Contact
public Contact() -
Contact
-
-
Method Details
-
toCreateJson
Description copied from interface:ICreatableConverts this object to its JSON representation for creation.This method generates a JSON string containing all properties needed to create a new instance of this resource in Microsoft Graph. Only properties appropriate for creation should be included (e.g., excluding read-only properties like ID, createdTime, etc.).
- Specified by:
toCreateJsonin interfaceICreatable- Returns:
- JSON string representation for creating this resource
-
toUpdateJson
Description copied from interface:IUpdatableConverts this object to its JSON representation for update.This method generates a JSON string containing all modified properties that should be updated in Microsoft Graph. Only writeable properties with non-null values are typically included.
- Specified by:
toUpdateJsonin interfaceIUpdatable- Returns:
- JSON string representation for updating this resource
-
toUpdateJson
Description copied from interface:IUpdatableConverts this object to JSON for update with specific properties.This method generates a JSON string containing only the specified properties. This enables partial updates where only certain fields need to be modified, reducing payload size and avoiding unintended changes to other properties.
- Specified by:
toUpdateJsonin interfaceIUpdatable- Parameters:
propertyNames- List of property names to include in the JSON. If null or empty, all modified properties are included.- Returns:
- JSON string representation for updating specific properties
-
toString
-
getId
-
setId
-
getChangeKey
-
getAssistantName
-
setAssistantName
-
getBirthday
-
setId
-
getCategories
-
getChildren
-
getCompanyName
-
setCompanyName
-
getCreatedTime
-
getDepartment
-
setDepartment
-
getDisplayName
-
setDisplayName
-
getEmailAddresses
-
getFileAs
-
setFileAs
-
getFlag
-
setFlag
-
getGender
-
setGender
-
getGeneration
-
setGeneration
-
getGivenName
-
setGivenName
-
getImAddresses
-
getInitials
-
setInitials
-
getJobTitle
-
setJobTitle
-
getLastModifiedTime
-
getManager
-
setManager
-
getMiddleName
-
setMiddleName
-
getNickName
-
setNickName
-
getOfficeLocation
-
setOfficeLocation
-
getParentFolderId
-
setParentFolderId
-
getPersonalNotes
-
setPersonalNotes
-
getPostalAddresses
-
getPhones
-
getWebsites
-
getProfession
-
setProfession
-
getSpouseName
-
setSpouseName
-
getSurname
-
setSurname
-
getTitle
-
setTitle
-
getWeddingAnniversary
-
setWeddingAnniversary
-
getYomiCompanyName
-
setYomiCompanyName
-
getYomiGivenName
-
setYomiGivenName
-
getYomiSurname
-
setYomiSurname
-