Skip to main content

graph openextension add

Adds an open extension to a resource

Usage

m365 graph openextension add [options]

Options

-n, --name <name>

The name of the open extension.

-i, --resourceId <resourceId>

The Id of the resource for which the extension is created.

-t, --resourceType <resourceType>

The resource type for which the extension is created. Allowed values are user, group, device, organization.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

This command allows using unknown options to add custom data to the open extension.

When adding an open extension to a user, it's possible to use the UPN as the resourceId.

Escaping JSON in PowerShell

When creating open extensions it's possible to enter a JSON string. In PowerShell 5 to 7.2 specific escaping rules apply due to an issue. Remember that you can also use file tokens instead.

Examples

Create a new open extension for a user specified by id. Extension properties are specified by unknown options.

m365 graph openextension add --resourceId eb77fbcf-6fe8-458b-985d-1747284793bc --resourceType user --name 'com.contoso.roamingSettings' --theme dark --color red --language English

Create a new open extension for a user specified by userName. Extension properties are specified by unknown options.

m365 graph openextension add --resourceId adelev@contoso.com --resourceType user --name 'com.contoso.roamingSettings' --theme dark --color red --language English

Create a new open extension for a group, one of the property represents a JSON object

m365 graph openextension add --resourceId eb77fbcf-6fe8-458b-985d-1747284793bc --resourceType group --name 'com.contoso.roamingSettings' --settings '{"theme": "dark", "color": "red", "language": "English"}' --supportedSystem 'Linux'

Response

{
"extensionName": "com.contoso.roamingSettings",
"settings": {
"theme": "dark",
"color": "red",
"language": "English"
},
"supportedSystem": "Linux",
"id": "com.contoso.roamingSettings"
}

More information

CTRL + M