Class User
- All Implemented Interfaces:
ICreatable,IUpdatable
The User resource represents a user account in Microsoft Entra ID (formerly Azure AD). This class provides access to user profile information, organizational data, and relationships to other Microsoft 365 resources like mail, calendar, contacts, and files.
User objects can be created, retrieved, updated, and deleted through the Microsoft Graph API. Common operations include:
- Getting user profile information (name, email, job title, etc.)
- Updating user properties (department, phone numbers, etc.)
- Managing user licenses and subscriptions
- Accessing user's mailbox, calendar, and contacts
- Managing user's OneDrive files
- Listing groups and teams the user belongs to
Example usage:
GraphClient client = new GraphClient(); // ... configure authentication ... // Get current user User user = client.me(); System.out.println(\"Display Name: \" + user.getDisplayName()); System.out.println(\"Email: \" + user.getEmailAddress()); System.out.println(\"Job Title: \" + user.getJobTitle()); // Update user properties user.setMobilePhone(\"+1-555-0123\"); client.updateUser(user.getId(), user);
- Since:
- 1.0
- See Also:
- User resource type, Get user, Update user
-
Field Summary
Fields inherited from class com.independentsoft.graph.DirectoryObject
id -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetCity()booleanbooleangetState()getType()booleanvoidsetAboutMe(String aboutMe)voidsetAccountEnabled(boolean accountEnabled)voidsetAgeGroup(AgeGroup ageGroup)voidsetAsResourceAccount(boolean isResourceAccount)voidsetBirthday(Date birthday)voidvoidsetCompanyName(String companyName)voidsetConsentProvidedForMinor(ConsentProvidedForMinor consentProvidedForMinor)voidsetCountry(String country)voidsetCreatedTime(Date createdTime)voidsetDeletedTime(Date deletedTime)voidsetDepartment(String department)voidsetDisplayName(String displayName)voidsetEmployeeId(String employeeId)voidsetExternalUserState(ExternalUserState externalUserState)voidsetFaxNumber(String faxNumber)voidsetGivenName(String givenName)voidsetHireDate(Date hireDate)voidsetJobTitle(String jobTitle)voidsetMailNickname(String mailNickname)voidsetMobilePhone(String mobilePhone)voidvoidsetOfficeLocation(String officeLocation)voidsetOnPremisesExtensionAttributes(OnPremisesExtensionAttributes onPremisesExtensionAttributes)voidsetOnPremisesImmutableId(String onPremisesImmutableId)voidsetPasswordPolicies(String passwordPolicies)voidsetPasswordProfile(PasswordProfile passwordProfile)voidsetPostalCode(String postalCode)voidsetPreferredDataLocation(String preferredDataLocation)voidsetPreferredLanguage(String preferredLanguage)voidsetPreferredName(String preferredName)voidsetPrincipalName(String principalName)voidsetShowInAddressList(boolean showInAddressList)voidsetSkuId(MailboxSettings mailboxSettings)voidvoidsetStreetAddress(String streetAddress)voidsetSurname(String surname)voidvoidsetUsageLocation(String usageLocation)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.Methods inherited from class com.independentsoft.graph.DirectoryObject
getId, setId
-
Constructor Details
-
User
public User() -
User
-
-
Method Details
-
toString
- Overrides:
toStringin classDirectoryObject
-
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
-
getAboutMe
-
setAboutMe
-
getAccountEnabled
public boolean getAccountEnabled() -
setAccountEnabled
public void setAccountEnabled(boolean accountEnabled) -
getAgeGroup
-
setAgeGroup
-
getBusinessPhones
-
getAssignedLicenses
-
getAssignedPlans
-
getBirthday
-
setBirthday
-
getCity
-
setCity
-
getCompanyName
-
setCompanyName
-
getConsentProvidedForMinor
-
setConsentProvidedForMinor
-
getCountry
-
setCountry
-
getCreatedTime
-
setCreatedTime
-
getDeletedTime
-
setDeletedTime
-
getDepartment
-
setDepartment
-
getDisplayName
-
setDisplayName
-
getEmployeeId
-
setEmployeeId
-
getExternalUserState
-
setExternalUserState
-
getExternalUserStateChangeTime
-
getFaxNumber
-
setFaxNumber
-
getGivenName
-
setGivenName
-
getImAddresses
-
isResourceAccount
public boolean isResourceAccount() -
setAsResourceAccount
public void setAsResourceAccount(boolean isResourceAccount) -
getHireDate
-
setHireDate
-
getInterests
-
getJobTitle
-
setJobTitle
-
getLegalAgeGroupClassification
-
getLicenseAssignmentStates
-
getEmailAddress
-
getMailboxSettings
-
setSkuId
-
getMailNickname
-
setMailNickname
-
getMobilePhone
-
setMobilePhone
-
getMySite
-
setMySite
-
getOfficeLocation
-
setOfficeLocation
-
getOnPremisesDistinguishedName
-
getOnPremisesDomainName
-
getOnPremisesExtensionAttributes
-
setOnPremisesExtensionAttributes
public void setOnPremisesExtensionAttributes(OnPremisesExtensionAttributes onPremisesExtensionAttributes) -
getOnPremisesImmutableId
-
setOnPremisesImmutableId
-
getOnPremisesLastSyncTime
-
getOnPremisesProvisioningErrors
-
getOnPremisesSamAccountName
-
getOnPremisesSecurityIdentifier
-
getOnPremisesSyncEnabled
public boolean getOnPremisesSyncEnabled() -
getOnPremisesUserPrincipalName
-
getOtherEmailAddresses
-
getPasswordPolicies
-
setPasswordPolicies
-
getPasswordProfile
-
setPasswordProfile
-
getPastProjects
-
getPostalCode
-
setPostalCode
-
getPreferredDataLocation
-
setPreferredDataLocation
-
getPreferredLanguage
-
setPreferredLanguage
-
getPreferredName
-
setPreferredName
-
getProvisionedPlans
-
getProxyAddresses
-
getRefreshTokensValidFromTime
-
getResponsibilities
-
getSchools
-
getShowInAddressList
public boolean getShowInAddressList() -
setShowInAddressList
public void setShowInAddressList(boolean showInAddressList) -
getSkills
-
getSignInActivity
-
getState
-
setState
-
getStreetAddress
-
setStreetAddress
-
getSurname
-
setSurname
-
getUsageLocation
-
setUsageLocation
-
getPrincipalName
-
setPrincipalName
-
getType
-
setType
-