:doc:`WorkMail <../../workmail>` / Client / list_groups_for_entity

**********************
list_groups_for_entity
**********************



.. py:method:: WorkMail.Client.list_groups_for_entity(**kwargs)

  

  Returns all the groups to which an entity belongs.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/workmail-2017-10-01/ListGroupsForEntity>`_  


  **Request Syntax**
  ::

    response = client.list_groups_for_entity(
        OrganizationId='string',
        EntityId='string',
        Filters={
            'GroupNamePrefix': 'string'
        },
        NextToken='string',
        MaxResults=123
    )
    
  :type OrganizationId: string
  :param OrganizationId: **[REQUIRED]** 

    The identifier for the organization under which the entity exists.

    

  
  :type EntityId: string
  :param EntityId: **[REQUIRED]** 

    The identifier for the entity.

     

    The entity ID can accept *UserId or GroupID*, *Username or Groupname*, or *email*.

     

    
    * Entity ID: 12345678-1234-1234-1234-123456789012 or S-1-1-12-1234567890-123456789-123456789-1234
     
    * Email address: entity@domain.tld
     
    * Entity name: entity
    

    

  
  :type Filters: dict
  :param Filters: 

    Limit the search results based on the filter criteria.

    

  
    - **GroupNamePrefix** *(string) --* 

      Filters only group names that start with the provided name prefix.

      

    
  
  :type NextToken: string
  :param NextToken: 

    The token to use to retrieve the next page of results. The first call does not contain any tokens.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of results to return in a single call.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Groups': [
              {
                  'GroupId': 'string',
                  'GroupName': 'string'
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Groups** *(list) --* 

        The overview of groups in an organization.

        
        

        - *(dict) --* 

          The identifier that contains the Group ID and name of a group.

          
          

          - **GroupId** *(string) --* 

            Group ID that matched the group.

            
          

          - **GroupName** *(string) --* 

            Group name that matched the group.

            
      
    
      

      - **NextToken** *(string) --* 

        The token to use to retrieve the next page of results. This value is `null` when there are no more results to return.

        
  
  **Exceptions**
  
  *   :py:class:`WorkMail.Client.exceptions.EntityNotFoundException`

  
  *   :py:class:`WorkMail.Client.exceptions.EntityStateException`

  
  *   :py:class:`WorkMail.Client.exceptions.OrganizationNotFoundException`

  
  *   :py:class:`WorkMail.Client.exceptions.OrganizationStateException`

  
  *   :py:class:`WorkMail.Client.exceptions.InvalidParameterException`

  