Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .devproxy/api-specs/sharepoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ components:
User.Read.All: User.Read.All
User.ReadWrite.All: User.ReadWrite.All
paths:
/_api/Brandcenter/Configuration:
get:
security:
- delegated:
- AllSites.Read
- AllSites.Write
- AllSites.Manage
- AllSites.FullControl
- application:
- Sites.Read.All
- Sites.ReadWrite.All
- Sites.Manage.All
- Sites.FullControl.All
responses:
200:
description: OK
/_api/contextinfo:
post:
security:
Expand Down
151 changes: 151 additions & 0 deletions docs/docs/cmd/spo/brandcenter/brandcenter-settings-list.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import Global from '/docs/cmd/_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# spo brandcenter settings list

Lists the brand center configuration

## Usage

```sh
m365 spo brandcenter settings list [options]
```

## Options

<Global />

## Permissions

<Tabs>
<TabItem value="Delegated">

| Resource | Permissions |
|-----------------|-----------------|
| Microsoft Graph | Sites.Read.All |
| SharePoint | AllSites.Read |

</TabItem>
<TabItem value="Application">

| Resource | Permissions |
|-----------------|------------------|
| Microsoft Graph | Sites.Read.All |
| SharePoint | Sites.Read.All |

</TabItem>
</Tabs>

## Examples

List all brand center config
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The example description uses the abbreviation "config" instead of the full word "configuration" used in the command description. For consistency, consider using "Lists the brand center configuration" or "Retrieve the brand center configuration".

Suggested change
List all brand center config
List all brand center configuration

Copilot uses AI. Check for mistakes.

```sh
m365 spo brandcenter settings list
```

## Response

<Tabs>
<TabItem value="JSON">

```json
{
"BrandColorsListId": "00000000-0000-0000-0000-000000000000",
"BrandColorsListUrl": null,
"BrandFontLibraryId": "23af51de-856c-4d00-aa11-0d03af0e46e3",
"BrandFontLibraryUrl": {
"DecodedUrl": "https://contoso.sharepoint.com/sites/BrandGuide/Fonts"
},
"IsBrandCenterSiteFeatureEnabled": true,
"IsPublicCdnEnabled": true,
"OrgAssets": {
"CentralAssetRepositoryLibraries": null,
"Domain": {
"DecodedUrl": "https://contoso.sharepoint.com"
},
"OrgAssetsLibraries": {
"OrgAssetsLibraries": [
{
"DisplayName": "Fonts",
"FileType": "",
"LibraryUrl": {
"DecodedUrl": "sites/BrandGuide/Fonts"
},
"ListId": "23af51de-856c-4d00-aa11-0d03af0e46e3",
"OrgAssetFlags": 0,
"OrgAssetType": 8,
"ThumbnailUrl": null,
"UniqueId": "00000000-0000-0000-0000-000000000000"
}
],
"Items": [
{
"DisplayName": "Fonts",
"FileType": "",
"LibraryUrl": {
"DecodedUrl": "sites/BrandGuide/Fonts"
},
"ListId": "23af51de-856c-4d00-aa11-0d03af0e46e3",
"OrgAssetFlags": 0,
"OrgAssetType": 8,
"ThumbnailUrl": null,
"UniqueId": "00000000-0000-0000-0000-000000000000"
}
]
},
"SiteId": "52b46e48-9c0c-40cb-a955-13eb6c717ff3",
"Url": {
"DecodedUrl": "/sites/BrandGuide"
},
"WebId": "206988d5-e133-4a24-819d-24101f3407ce"
},
"SiteId": "52b46e48-9c0c-40cb-a955-13eb6c717ff3",
"SiteUrl": "https://contoso.sharepoint.com/sites/BrandGuide"
}
```

</TabItem>
<TabItem value="Text">

```txt
BrandColorsListId : 00000000-0000-0000-0000-000000000000
BrandColorsListUrl : null
BrandFontLibraryId : 23af51de-856c-4d00-aa11-0d03af0e46e3
BrandFontLibraryUrl : {"DecodedUrl":"https://contoso.sharepoint.com/sites/BrandGuide/Fonts"}
IsBrandCenterSiteFeatureEnabled: true
IsPublicCdnEnabled : true
OrgAssets : {"CentralAssetRepositoryLibraries":null,"Domain":{"DecodedUrl":"https://contoso.sharepoint.com"},"OrgAssetsLibraries":{"OrgAssetsLibraries":[{"DisplayName":"Fonts","FileType":"","LibraryUrl":{"DecodedUrl":"sites/BrandGuide/Fonts"},"ListId":"23af51de-856c-4d00-aa11-0d03af0e46e3","OrgAssetFlags":0,"OrgAssetType":8,"ThumbnailUrl":null,"UniqueId":"00000000-0000-0000-0000-000000000000"}],"Items":[{"DisplayName":"Fonts","FileType":"","LibraryUrl":{"DecodedUrl":"sites/BrandGuide/Fonts"},"ListId":"23af51de-856c-4d00-aa11-0d03af0e46e3","OrgAssetFlags":0,"OrgAssetType":8,"ThumbnailUrl":null,"UniqueId":"00000000-0000-0000-0000-000000000000"}]},"SiteId":"52b46e48-9c0c-40cb-a955-13eb6c717ff3","Url":{"DecodedUrl":"/sites/BrandGuide"},"WebId":"206988d5-e133-4a24-819d-24101f3407ce"}
SiteId : 52b46e48-9c0c-40cb-a955-13eb6c717ff3
SiteUrl : https://contoso.sharepoint.com/sites/BrandGuide
```

</TabItem>
<TabItem value="CSV">

```csv
BrandColorsListId,BrandColorsListUrl,BrandFontLibraryId,IsBrandCenterSiteFeatureEnabled,IsPublicCdnEnabled,SiteId,SiteUrl
00000000-0000-0000-0000-000000000000,,23af51de-856c-4d00-aa11-0d03af0e46e3,1,1,52b46e48-9c0c-40cb-a955-13eb6c717ff3,https://contoso.sharepoint.com/sites/BrandGuide
```

</TabItem>
<TabItem value="Markdown">

```md
# spo brandcenter settings list --debug "false" --verbose "false"

Date: 12/1/2025

Property | Value
---------|-------
BrandColorsListId | 00000000-0000-0000-0000-000000000000
BrandFontLibraryId | 23af51de-856c-4d00-aa11-0d03af0e46e3
IsBrandCenterSiteFeatureEnabled | true
IsPublicCdnEnabled | true
SiteId | 52b46e48-9c0c-40cb-a955-13eb6c717ff3
SiteUrl | https://contoso.sharepoint.com/sites/BrandGuide
```

</TabItem>
</Tabs>
9 changes: 9 additions & 0 deletions docs/src/config/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,15 @@ const sidebars: SidebarsConfig = {
}
]
},
{
brandcenter: [
{
type: 'doc',
label: 'brandcenter settings list',
id: 'cmd/spo/brandcenter/brandcenter-settings-list'
}
]
},
{
cdn: [
{
Expand Down
1 change: 1 addition & 0 deletions src/m365/spo/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
APPLICATIONCUSTOMIZER_SET: `${prefix} applicationcustomizer set`,
APPPAGE_ADD: `${prefix} apppage add`,
APPPAGE_SET: `${prefix} apppage set`,
BRANDCENTER_SETTINGS_LIST: `${prefix} brandcenter settings list`,
CDN_GET: `${prefix} cdn get`,
CDN_ORIGIN_ADD: `${prefix} cdn origin add`,
CDN_ORIGIN_LIST: `${prefix} cdn origin list`,
Expand Down
176 changes: 176 additions & 0 deletions src/m365/spo/commands/brandcenter/brandcenter-settings-list.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
import assert from 'assert';
import sinon from 'sinon';
import auth from '../../../../Auth.js';
import { cli } from '../../../../cli/cli.js';
import { CommandInfo } from '../../../../cli/CommandInfo.js';
import { Logger } from '../../../../cli/Logger.js';
import { CommandError } from '../../../../Command.js';
import request from '../../../../request.js';
import { telemetry } from '../../../../telemetry.js';
import { pid } from '../../../../utils/pid.js';
import { session } from '../../../../utils/session.js';
import { sinonUtil } from '../../../../utils/sinonUtil.js';
import { z } from 'zod';
import commands from '../../commands.js';
import command from './brandcenter-settings-list.js';

describe(commands.BRANDCENTER_SETTINGS_LIST, () => {
let log: any[];
let logger: Logger;
let loggerLogSpy: sinon.SinonSpy;
let commandInfo: CommandInfo;
let commandOptionsSchema: z.ZodTypeAny;

const successResponse = {
"BrandColorsListId": "00000000-0000-0000-0000-000000000000",
"BrandColorsListUrl": null,
"BrandFontLibraryId": "23af51de-856c-4d00-aa11-0d03af0e46e3",
"BrandFontLibraryUrl": {
"DecodedUrl": "https://contoso.sharepoint.com/sites/BrandGuide/Fonts"
},
"IsBrandCenterSiteFeatureEnabled": true,
"IsPublicCdnEnabled": true,
"OrgAssets": {
"CentralAssetRepositoryLibraries": null,
"Domain": {
"DecodedUrl": "https://contoso.sharepoint.com"
},
"OrgAssetsLibraries": {
"OrgAssetsLibraries": [
{
"DisplayName": "Fonts",
"FileType": "",
"LibraryUrl": {
"DecodedUrl": "sites/BrandGuide/Fonts"
},
"ListId": "23af51de-856c-4d00-aa11-0d03af0e46e3",
"OrgAssetFlags": 0,
"OrgAssetType": 8,
"ThumbnailUrl": null,
"UniqueId": "00000000-0000-0000-0000-000000000000"
}
],
"Items": [
{
"DisplayName": "Fonts",
"FileType": "",
"LibraryUrl": {
"DecodedUrl": "sites/BrandGuide/Fonts"
},
"ListId": "23af51de-856c-4d00-aa11-0d03af0e46e3",
"OrgAssetFlags": 0,
"OrgAssetType": 8,
"ThumbnailUrl": null,
"UniqueId": "00000000-0000-0000-0000-000000000000"
}
]
},
"SiteId": "52b46e48-9c0c-40cb-a955-13eb6c717ff3",
"Url": {
"DecodedUrl": "/sites/BrandGuide"
},
"WebId": "206988d5-e133-4a24-819d-24101f3407ce"
},
"SiteId": "52b46e48-9c0c-40cb-a955-13eb6c717ff3",
"SiteUrl": "https://contoso.sharepoint.com/sites/BrandGuide"
};

before(() => {
sinon.stub(auth, 'restoreAuth').resolves();
sinon.stub(telemetry, 'trackEvent').resolves();
sinon.stub(pid, 'getProcessName').returns('');
sinon.stub(session, 'getId').returns('');

auth.connection.active = true;
auth.connection.spoUrl = 'https://contoso.sharepoint.com';
commandInfo = cli.getCommandInfo(command);
commandOptionsSchema = commandInfo.command.getSchemaToParse()!;
});

beforeEach(() => {
log = [];
logger = {
log: async (msg: string) => {
log.push(msg);
},
logRaw: async (msg: string) => {
log.push(msg);
},
logToStderr: async (msg: string) => {
log.push(msg);
}
};
loggerLogSpy = sinon.spy(logger, 'log');
});

afterEach(() => {
sinonUtil.restore([
request.get
]);
});

after(() => {
sinon.restore();
auth.connection.active = false;
auth.connection.spoUrl = undefined;
});

it('has correct name', () => {
assert.strictEqual(command.name, commands.BRANDCENTER_SETTINGS_LIST);
});

it('has a description', () => {
assert.notStrictEqual(command.description, null);
});

it('passes validation with no options', () => {
const actual = commandOptionsSchema.safeParse({});
assert.strictEqual(actual.success, true);
});

it('fails validation with unknown options', () => {
const actual = commandOptionsSchema.safeParse({ option: "value" });
assert.strictEqual(actual.success, false);
});

it('successfully lists brand center settings', async () => {
const getStub = sinon.stub(request, 'get').callsFake(async (opts: any) => {
if (opts.url === `https://contoso.sharepoint.com/_api/Brandcenter/Configuration`) {
return successResponse;
}

throw 'Invalid request';
});

await command.action(logger, { options: {} });
assert(getStub.calledOnce);
assert(loggerLogSpy.calledWith(successResponse));
});

it('successfully lists brand center settings with verbose output', async () => {
const getStub = sinon.stub(request, 'get').callsFake(async (opts: any) => {
if (opts.url === `https://contoso.sharepoint.com/_api/Brandcenter/Configuration`) {
return successResponse;
}

throw 'Invalid request';
});

await command.action(logger, { options: { verbose: true } });
assert(getStub.calledOnce);
assert(loggerLogSpy.calledWith(successResponse));
});

it('correctly handles error when retrieving settings', async () => {
sinon.stub(request, 'get').callsFake(async (opts) => {
if (opts.url === 'https://contoso.sharepoint.com/_api/Brandcenter/Configuration') {
throw 'An unknown error has occurred';
}

throw 'Invalid request';
});

await assert.rejects(command.action(logger, { options: {} }),
new CommandError(`An unknown error has occurred`));
});
});
Loading