1
votes

We are trying to create a schema with Microsoft Graph extensions and keep getting the error:

"code": "Request_BadRequest", "message": "The value for name contains invalid characters. Please ensure it matches the regex '[0-9a-zA-Z]+'.",

We can't get it to work whatever 'name' value we use

Everything else just works fine on the Graph Explorer and we login succesfully with extra permissions User.ReadWrite.All, Directory.ReadWrite.All, Directory.AccessAsUser.All.

This is the request we are doing on Graph Explorer:

POST to https://graph.microsoft.com/v1.0/schemaExtensions with body:

{
    "id":"something-commerce_dynamics",
    "description": "Contact data from Dynamics",
    "owner": "{our app id}",
    "targetTypes": [
        "User"
    ],
    "properties": [
        {
            "name": "companyMailAddress",
            "type": "String"
        }
    ]
}
1

1 Answers

1
votes

Turns out Graph can mean the 'id' field when it says 'name'.

When I didn't use the domain in the ID (something-commerce) and left out the _ as well everything went fine.

So the following works:

{
    "id":"dynamicsContactData",
    "description": "Contact data from Dynamics",
    "owner": "{our app id}",
    "targetTypes": [
        "User"
    ],
    "properties": [
        {
            "name": "companyMailAddress",
            "type": "String"
        }
    ]
}