Skip to main content

spo app add

Adds an app to the specified SharePoint Online app catalog

Usage

m365 spo app add [options]

Options

-p, --filePath <filePath>

Absolute or relative path to the solution package file to add to the app catalog.

--overwrite

Set to overwrite the existing package file.

-s, --appCatalogScope [appCatalogScope]

Scope of the app catalog. Allowed values: tenant, sitecollection. Defaults to tenant.

-u, --appCatalogUrl [appCatalogUrl]

The URL of the app catalog where the solution package will be added. It must be specified when the scope is sitecollection.

-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

When specifying the path to the app package file you can use both relative and absolute paths. Note, that ~ in the path, will not be resolved and will most likely result in an error.

When adding an app to the tenant app catalog, it's not necessary to specify the tenant app catalog URL. When the URL is not specified, the CLI will try to resolve the URL itself. Specifying the app catalog URL is required when you want to add the app to a site collection app catalog.

When specifying site collection app catalog, you can specify the URL either with our without the AppCatalog part, for example https://contoso.sharepoint.com/sites/team-a/AppCatalog or https://contoso.sharepoint.com/sites/team-a. CLI will accept both formats.

If you try to upload a package that already exists in the app catalog without specifying the --overwrite option, the command will fail with an error stating that the specified package already exists.

Examples

Add the package to the tenant app catalog.

m365 spo app add --filePath /Users/pnp/spfx/sharepoint/solution/spfx.sppkg

Overwrite the package in the tenant app catalog with the newer version.

m365 spo app add --filePath sharepoint/solution/spfx.sppkg --overwrite

Add the package to the site collection app catalog of the specified site.

m365 spo app add --filePath c:\spfx.sppkg --appCatalogScope sitecollection --appCatalogUrl https://contoso.sharepoint.com/sites/site1

Response

{
"CheckInComment": "",
"CheckOutType": 2,
"ContentTag": "{4BBC7873-4638-487D-900B-EF917A907C5A},2,1",
"CustomizedPageStatus": 0,
"ETag": "\"{4BBC7873-4638-487D-900B-EF917A907C5A},2\"",
"Exists": true,
"ExistsAllowThrowForPolicyFailures": true,
"IrmEnabled": false,
"Length": "757211",
"Level": 1,
"LinkingUri": null,
"LinkingUrl": "",
"MajorVersion": 1,
"MinorVersion": 0,
"Name": "spfx.sppkg",
"ServerRelativeUrl": "/sites/apps/AppCatalog/spfx.sppkg",
"TimeCreated": "2023-10-02T06:53:30Z",
"TimeLastModified": "2023-10-02T06:53:30Z",
"Title": "spfx-client-side-solution",
"UIVersion": 512,
"UIVersionLabel": "1.0",
"UniqueId": "4bbc7873-4638-487d-900b-ef917a907c5a"
}

More information

CTRL + M