Create Graph API giving bad request

Gajendra Jangid 0 Reputation points
2025-01-13T12:46:36.29+00:00

I am trying to create a Group(com.microsoft.graph.models.Group) using Graph API. But it is giving below error. I am using Group's name as value for mailNickname

GroupName is following this format. String groupName = String.format(GROUP_NAME_FORMAT, programId, environmentId, resourceName, grpType.getValue()); String GROUP_NAME_FORMAT = "aem-sp-cm-p%s-e%s-%s-%s-group"; Something like this(aem-sp-cm-p123456-e112233-sa0123456logshared0d2885-full-group)(this is having length less than 64 characters and does not contain invalid characters.)

Exception: Error code: Request_BadRequestError message: Invalid value specified for property 'mailNickname' of resource 'Group'.POST https://graph.microsoft.com/v1.0/groupsSdkVersion : graph-java/v3.4.0SdkVersion : graph-java/v3.4.0[...]400 : Bad Request

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-01-14T02:32:50.4433333+00:00

    Hello Gajendra Jangid,

    Thank you for reaching out to Microsoft Support!

    For your question, we just tested it in Graph Explorer, and it worked fine, with the following results:

    User's image

    It is recommended that you test it in Graph Explorer first to see if it can be created successfully and troubleshoot the naming problem for names.

    Reference document:

    https://learn.microsoft.com/en-us/graph/api/group-post-groups?view=graph-rest-1.0&tabs=http

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.