Class Group

java.lang.Object
com.independentsoft.graph.DirectoryObject
com.independentsoft.graph.groups.Group
All Implemented Interfaces:
ICreatable, IUpdatable

public class Group extends DirectoryObject implements ICreatable, IUpdatable
Represents a Microsoft 365 group in Microsoft Graph.

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
  • Constructor Details

    • Group

      public Group()
    • Group

      public Group(JsonObject jsonObject)
  • Method Details

    • toCreateJson

      public String toCreateJson()
      Description copied from interface: ICreatable
      Converts 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:
      toCreateJson in interface ICreatable
      Returns:
      JSON string representation for creating this resource
    • toUpdateJson

      public String toUpdateJson()
      Description copied from interface: IUpdatable
      Converts 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:
      toUpdateJson in interface IUpdatable
      Returns:
      JSON string representation for updating this resource
    • toUpdateJson

      public String toUpdateJson(List<String> propertyNames)
      Description copied from interface: IUpdatable
      Converts 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:
      toUpdateJson in interface IUpdatable
      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

      public String toString()
      Overrides:
      toString in class DirectoryObject
    • isAllowExternalSenders

      public boolean isAllowExternalSenders()
    • allowExternalSenders

      public void allowExternalSenders(boolean allowExternalSenders)
    • getAssignedLabels

      public List<AssignedLabel> getAssignedLabels()
    • getAssignedLicenses

      public List<AssignedLicense> getAssignedLicenses()
    • isAutoSubscribeNewMembers

      public boolean isAutoSubscribeNewMembers()
    • autoSubscribeNewMembers

      public void autoSubscribeNewMembers(boolean autoSubscribeNewMembers)
    • getClassification

      public String getClassification()
    • setClassification

      public void setClassification(String classification)
    • getCreatedTime

      public Date getCreatedTime()
    • getDeletedTime

      public Date getDeletedTime()
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getDisplayName

      public String getDisplayName()
    • setDisplayName

      public void setDisplayName(String displayName)
    • getExpirationTime

      public Date getExpirationTime()
    • getTypes

      public List<GroupType> 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

      public LicenseProcessingState getLicenseProcessingState()
    • getEmailAddress

      public String getEmailAddress()
    • isMailEnabled

      public boolean isMailEnabled()
    • setAsMailEnabled

      public void setAsMailEnabled(boolean isMailEnabled)
    • getMailNickname

      public String getMailNickname()
    • setMailNickname

      public void setMailNickname(String mailNickname)
    • getMembershipRule

      public String getMembershipRule()
    • setMembershipRule

      public void setMembershipRule(String membershipRule)
    • getMembershipRuleProcessingState

      public MembershipRuleProcessingState getMembershipRuleProcessingState()
    • setMembershipRuleProcessingState

      public void setMembershipRuleProcessingState(MembershipRuleProcessingState membershipRuleProcessingState)
    • getOnPremisesLastSyncTime

      public Date getOnPremisesLastSyncTime()
    • getOnPremisesNetBiosName

      public String getOnPremisesNetBiosName()
    • getOnPremisesProvisioningErrors

      public List<OnPremisesProvisioningError> getOnPremisesProvisioningErrors()
    • getOnPremisesSamAccountName

      public String getOnPremisesSamAccountName()
    • getOnPremisesSecurityIdentifier

      public String getOnPremisesSecurityIdentifier()
    • onPremisesSyncEnabled

      public boolean onPremisesSyncEnabled()
    • getPreferredDataLocation

      public String getPreferredDataLocation()
    • setPreferredDataLocation

      public void setPreferredDataLocation(String preferredDataLocation)
    • getPreferredLanguage

      public String getPreferredLanguage()
    • setPreferredLanguage

      public void setPreferredLanguage(String preferredLanguage)
    • getProxyAddresses

      public List<String> getProxyAddresses()
    • getRenewedTime

      public Date getRenewedTime()
    • isSecurityEnabled

      public boolean isSecurityEnabled()
    • setAsSecurityEnabled

      public void setAsSecurityEnabled(boolean isSecurityEnabled)
    • getTheme

      public GroupColorTheme getTheme()
    • setTheme

      public void setTheme(GroupColorTheme theme)
    • unseenConversationsCount

      public int unseenConversationsCount()
    • unseenCount

      public int unseenCount()
    • unseenMessagesCount

      public int unseenMessagesCount()
    • getVisibility

      public GroupVisibility getVisibility()
    • setVisibility

      public void setVisibility(GroupVisibility visibility)
    • getOwners

      public List<String> getOwners()
    • getMembers

      public List<String> getMembers()