Class Group
- All Implemented Interfaces:
ICreatable,IUpdatable
The Group resource represents a Microsoft 365 group, which is a collection of users who share access to resources in Microsoft services or in your app. Groups can be used for collaboration, including shared mailboxes, calendars, files, SharePoint sites, and more.
Microsoft 365 groups support various types and purposes:
- Unified Groups - Microsoft 365 groups with mail and collaboration features
- Security Groups - Used for managing user access to resources
- Mail-enabled Security Groups - Security groups with email capabilities
- Distribution Lists - Mail-only groups for email distribution
Key features include:
- Member and owner management
- Group email address and conversations
- Shared calendar and files
- Teams integration (every Team has an underlying Group)
- License assignment
- Dynamic membership rules
- Expiration and renewal policies
Example usage:
GraphClient client = new GraphClient();
// ... configure authentication ...
// Create a new Microsoft 365 group
Group group = new Group();
group.setDisplayName("Marketing Team");
group.setMailNickname("marketing");
group.setDescription("Marketing team collaboration");
group.setMailEnabled(true);
group.setSecurityEnabled(false);
group.getTypes().add(GroupType.UNIFIED);
// Set visibility
group.setVisibility(GroupVisibility.PUBLIC);
// Create the group
Group createdGroup = client.createGroup(group);
// Add members
client.addGroupMember(createdGroup.getId(), userId);
// List all groups
List<Group> groups = client.listGroups();
- Since:
- 1.0
- See Also:
- group resource type, Create group, Microsoft 365 groups overview
-
Field Summary
Fields inherited from class com.independentsoft.graph.DirectoryObject
id -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidallowExternalSenders(boolean allowExternalSenders)voidautoSubscribeNewMembers(boolean autoSubscribeNewMembers)getTheme()getTypes()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidsetAsMailEnabled(boolean isMailEnabled)voidsetAsSecurityEnabled(boolean isSecurityEnabled)voidsetAsSubscribedByMail(boolean isSubscribedByMail)voidsetClassification(String classification)voidsetDescription(String description)voidsetDisplayName(String displayName)voidsetHasMembersWithLicenseErrors(boolean hasMembersWithLicenseErrors)voidsetHideFromAddressLists(boolean hideFromAddressLists)voidsetHideFromOutlookClients(boolean hideFromOutlookClients)voidsetMailNickname(String mailNickname)voidsetMembershipRule(String membershipRule)voidsetMembershipRuleProcessingState(MembershipRuleProcessingState membershipRuleProcessingState)voidsetPreferredDataLocation(String preferredDataLocation)voidsetPreferredLanguage(String preferredLanguage)voidsetTheme(GroupColorTheme theme)voidsetVisibility(GroupVisibility visibility)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.intintintMethods inherited from class com.independentsoft.graph.DirectoryObject
getId, setId
-
Constructor Details
-
Group
public Group() -
Group
-
-
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
- Overrides:
toStringin classDirectoryObject
-
isAllowExternalSenders
public boolean isAllowExternalSenders() -
allowExternalSenders
public void allowExternalSenders(boolean allowExternalSenders) -
getAssignedLabels
-
getAssignedLicenses
-
isAutoSubscribeNewMembers
public boolean isAutoSubscribeNewMembers() -
autoSubscribeNewMembers
public void autoSubscribeNewMembers(boolean autoSubscribeNewMembers) -
getClassification
-
setClassification
-
getCreatedTime
-
getDeletedTime
-
getDescription
-
setDescription
-
getDisplayName
-
setDisplayName
-
getExpirationTime
-
getTypes
-
hasMembersWithLicenseErrors
public boolean hasMembersWithLicenseErrors() -
setHasMembersWithLicenseErrors
public void setHasMembersWithLicenseErrors(boolean hasMembersWithLicenseErrors) -
hideFromAddressLists
public boolean hideFromAddressLists() -
setHideFromAddressLists
public void setHideFromAddressLists(boolean hideFromAddressLists) -
hideFromOutlookClients
public boolean hideFromOutlookClients() -
setHideFromOutlookClients
public void setHideFromOutlookClients(boolean hideFromOutlookClients) -
isSubscribedByMail
public boolean isSubscribedByMail() -
setAsSubscribedByMail
public void setAsSubscribedByMail(boolean isSubscribedByMail) -
getLicenseProcessingState
-
getEmailAddress
-
isMailEnabled
public boolean isMailEnabled() -
setAsMailEnabled
public void setAsMailEnabled(boolean isMailEnabled) -
getMailNickname
-
setMailNickname
-
getMembershipRule
-
setMembershipRule
-
getMembershipRuleProcessingState
-
setMembershipRuleProcessingState
public void setMembershipRuleProcessingState(MembershipRuleProcessingState membershipRuleProcessingState) -
getOnPremisesLastSyncTime
-
getOnPremisesNetBiosName
-
getOnPremisesProvisioningErrors
-
getOnPremisesSamAccountName
-
getOnPremisesSecurityIdentifier
-
onPremisesSyncEnabled
public boolean onPremisesSyncEnabled() -
getPreferredDataLocation
-
setPreferredDataLocation
-
getPreferredLanguage
-
setPreferredLanguage
-
getProxyAddresses
-
getRenewedTime
-
isSecurityEnabled
public boolean isSecurityEnabled() -
setAsSecurityEnabled
public void setAsSecurityEnabled(boolean isSecurityEnabled) -
getTheme
-
setTheme
-
unseenConversationsCount
public int unseenConversationsCount() -
unseenCount
public int unseenCount() -
unseenMessagesCount
public int unseenMessagesCount() -
getVisibility
-
setVisibility
-
getOwners
-
getMembers
-