Class GraphHelpersRequestBuilder


public class GraphHelpersRequestBuilder extends GraphRequestBuilder
Helper request builder that combines multiple Apis to create logical helper methods for ease of use.
  • Constructor Details

    • GraphHelpersRequestBuilder

      public GraphHelpersRequestBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential)
      Instantiates a new RequestBuilder instance and sets the default values.
      Parameters:
      organizationUrl - Represents organization location request url.
      accessTokenCredential - Access token credential object.
  • Method Details

    • createUser

      public GraphUser createUser(String emailId) throws AzDException
      Materialize an existing AAD or MSA user into the VSTS account. NOTE: Created users are not active in an account unless they have been explicitly assigned a parent group at creation time or have signed in and been autolicensed through AAD group memberships. Adding a user to an account is required before the user can be added to VSTS groups or assigned an asset. Create a new user using the principal name as a reference to an existing user from an external AD or AAD backed provider. If the user to be added corresponds to a user that was previously deleted, then that user will be restored.
      Parameters:
      emailId - provide the user principal name (email address) of the user to be added.
      Returns:
      GraphUser GraphUser
      Throws:
      AzDException - Default Api Exception handler.
    • addUserToGroup

      public GraphUser addUserToGroup(String emailId, String groupDescriptor) throws AzDException
      Materialize an existing AAD or MSA user into the VSTS account. Add the newly created user as a member of an existing VSTS group by providing the group descriptor.
      Parameters:
      emailId - provide the user principal name (email address) of the user to be added.
      groupDescriptor - provide the group descriptor.
      Returns:
      GraphUser GraphUser
      Throws:
      AzDException - Default Api Exception handler.
    • getGroupMembersOf

      public GraphMemberships getGroupMembersOf(String groupDescriptor) throws AzDException
      get subjects (users, groups) that are a member of the specified group
      Parameters:
      groupDescriptor - The descriptor of the container group
      Returns:
      GraphMemberships GraphMemberships
      Throws:
      AzDException - Default Api Exception handler.
    • getMemberOfGroups

      public GraphMemberships getMemberOfGroups(String subjectDescriptor) throws AzDException
      get groups that the specified subject (user, group) belongs to
      Parameters:
      subjectDescriptor - The descriptor of the subject (either user or group) that belongs to a container
      Returns:
      GraphMemberships GraphMemberships
      Throws:
      AzDException - Default Api Exception handler.
    • createGroup

      public GraphGroup createGroup(String displayName, String description) throws AzDException
      create a local group at the collection level
      Parameters:
      displayName - The name of the group
      description - A generally more verbose description of the group
      Returns:
      GraphMembership GraphMembership
      Throws:
      AzDException - Default Api Exception handler.
    • createGroup

      public GraphGroup createGroup(String displayName, String description, String projectDescriptor) throws AzDException
      create a local group at the project level
      Parameters:
      displayName - The name of the group
      description - A generally more verbose description of the group
      Returns:
      GraphMembership GraphMembership
      Throws:
      AzDException - Default Api Exception handler.
    • subjectLookup

      public SubjectLookupResponse subjectLookup(String... descriptors) throws AzDException
      resolve descriptors to subjects

      Refer to REST API documentation on storage keys

      Parameters:
      descriptors - user and group descriptor strings
      Returns:
      SubjectLookupResponse SubjectLookupResponse
      Throws:
      AzDException - Default Api Exception handler.