Skip to content
Draft
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
29 changes: 29 additions & 0 deletions .devproxy/api-specs/sharepoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,35 @@ paths:
responses:
200:
description: OK
/_api/web/alerts/GetById({alertId}):
get:
parameters:
- name: alertId
in: path
required: true
schema:
type: string
example: "'7cbb4c8d-8e4d-4d2e-9c6f-3f1d8b2e6a0e'"
- name: $expand
in: query
required: false
schema:
type: string
example: "List,User,List/Rootfolder,Item"
- name: $select
in: query
required: false
schema:
type: string
example: "*,List/Id,List/Title,List/Rootfolder/ServerRelativeUrl,Item/ID,Item/FileRef,Item/Guid"
security:
- delegated:
- AllSites.FullControl
- application:
- Sites.FullControl.All
responses:
200:
description: OK
/_api/web/alerts:
get:
parameters:
Expand Down
189 changes: 189 additions & 0 deletions docs/docs/cmd/spo/site/site-alert-get.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
import Global from '/docs/cmd/_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# spo site alert get

Retrieves details of a specific alert from a SharePoint list

## Usage

```sh
m365 spo site alert get [options]
```

## Options

```md definition-list
`-u, --webUrl <webUrl>`
: The URL of the SharePoint site

`--id <id>`
: The ID of the alert
Comment on lines +18 to +22
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`-u, --webUrl <webUrl>`
: The URL of the SharePoint site
`--id <id>`
: The ID of the alert
`-u, --webUrl <webUrl>`
: The URL of the SharePoint site.
`--id <id>`
: The ID of the alert.

```

<Global />

## Permissions

<Tabs>
<TabItem value="Delegated">

| Resource | Permissions |
|------------|----------------------|
| SharePoint | AllSites.FullControl |

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

| Resource | Permissions |
|------------|-----------------------|
| SharePoint | Sites.FullControl.All |

</TabItem>
</Tabs>

## Examples

Get details of an alert by ID

```sh
m365 spo site alert get --webUrl https://contoso.sharepoint.com/sites/Marketing --id 7cbb4c8d-8e4d-4d2e-9c6f-3f1d8b2e6a0e
```

## Response

<Tabs>
<TabItem value="JSON">

```json
{
"AlertFrequency": 0,
"AlertTemplateName": "SPAlertTemplateType.DocumentLibrary",
"AlertType": 0,
"AlwaysNotify": false,
"DeliveryChannels": 1,
"EventType": -1,
"Filter": "",
"ID": "a188ee89-72e2-4327-9802-8d0c408ec129",
"List": {
"Id": "1ec04825-b082-46f8-9a1c-b6b54d83bc46",
"RootFolder": {
"ServerRelativeUrl": "/sites/Marketing/Documents"
},
"Title": "Documents"
},
"Properties": [
{
"Key": "dispformurl",
"Value": "Documents/Forms/DispForm.aspx",
"ValueType": "Edm.String"
},
{
"Key": "filterindex",
"Value": "0",
"ValueType": "Edm.String"
},
{
"Key": "defaultitemopen",
"Value": "Browser",
"ValueType": "Edm.String"
},
{
"Key": "sendurlinsms",
"Value": "False",
"ValueType": "Edm.String"
},
{
Comment on lines +76 to +97
Copy link
Contributor

Choose a reason for hiding this comment

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

For a list, we require to only show 1 item of the list to reduce cluttering the docs. Let's update this for other response types as well.

"Key": "mobileurl",
"Value": "https://contoso.sharepoint.com/_layouts/15/mobile/",
"ValueType": "Edm.String"
},
{
"Key": "eventtypeindex",
"Value": "0",
"ValueType": "Edm.String"
},
{
"Key": "siteurl",
"Value": "https://contoso.sharepoint.com",
"ValueType": "Edm.String"
}
],
"Status": 0,
"Title": "Documents",
"User": {
"Email": "[email protected]",
"Expiration": "",
"Id": 10,
"IsEmailAuthenticationGuestUser": false,
"IsHiddenInUI": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": true,
"LoginName": "i:0#.f|membership|[email protected]",
"PrincipalType": 1,
"Title": "Admin User",
"UserId": {
"NameId": "100320009d8267fc",
"NameIdIssuer": "urn:federation:microsoftonline"
},
"UserPrincipalName": "[email protected]"
},
"UserId": 10
}
```

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

```text
AlertFrequency : 0
AlertTemplateName: SPAlertTemplateType.DocumentLibrary
AlertType : 0
AlwaysNotify : false
DeliveryChannels : 1
EventType : -1
Filter :
ID : a188ee89-72e2-4327-9802-8d0c408ec129
List : {"RootFolder":{"ServerRelativeUrl":"/FlowTest"},"Id":"1ec04825-b082-46f8-9a1c-b6b54d83bc46","Title":"FlowTest"}
Properties : [{"Key":"dispformurl","Value":"FlowTest/Forms/DispForm.aspx","ValueType":"Edm.String"},{"Key":"filterindex","Value":"0","ValueType":"Edm.String"},{"Key":"defaultitemopen","Value":"Browser","ValueType":"Edm.String"},{"Key":"sendurlinsms","Value":"False","ValueType":"Edm.String"},{"Key":"mobileurl","Value":"https://contoso.sharepoint.com/_layouts/15/mobile/","ValueType":"Edm.String"},{"Key":"eventtypeindex","Value":"0","ValueType":"Edm.String"},{"Key":"siteurl","Value":"https://contoso.sharepoint.com","ValueType":"Edm.String"}]
Status : 0
Title : FlowTest
User : {"Id":10,"IsHiddenInUI":false,"LoginName":"i:0#.f|membership|[email protected]","Title":"Admin","PrincipalType":1,"Email":"[email protected]","Expiration":"","IsEmailAuthenticationGuestUser":false,"IsShareByEmailGuestUser":false,"IsSiteAdmin":true,"UserId":{"NameId":"100320009d8267fc","NameIdIssuer":"urn:federation:microsoftonline"},"UserPrincipalName":"[email protected]"}
UserId : 10
```

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

```csv
AlertFrequency,AlertTemplateName,AlertType,AlwaysNotify,DeliveryChannels,EventType,Filter,ID,Status,Title,UserId
0,SPAlertTemplateType.DocumentLibrary,0,false,1,-1,,a188ee89-72e2-4327-9802-8d0c408ec129,0,Documents,10
```

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

```md
# spo site alert get --webUrl "https://contoso.sharepoint.com/sites/Marketing" --id "7cbb4c8d-8e4d-4d2e-9c6f-3f1d8b2e6a0e"

Date: 10/1/2025

Property | Value
---------|-------
AlertFrequency | 0
AlertTemplateName | SPAlertTemplateType.DocumentLibrary
AlertType | 0
AlwaysNotify | false
DeliveryChannels | 1
EventType | -1
Filter |
ID | a188ee89-72e2-4327-9802-8d0c408ec129
Status | 0
Title | Documents
UserId | 10
```

</TabItem>
</Tabs>

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove one empty line at the end of the file.

5 changes: 5 additions & 0 deletions docs/src/config/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,11 @@ const sidebars: SidebarsConfig = {
label: 'site admin remove',
id: 'cmd/spo/site/site-admin-remove'
},
{
type: 'doc',
label: 'site alert get',
id: 'cmd/spo/site/site-alert-get'
},
{
type: 'doc',
label: 'site alert list',
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 @@ -258,6 +258,7 @@ export default {
SITE_ADMIN_ADD: `${prefix} site admin add`,
SITE_ADMIN_LIST: `${prefix} site admin list`,
SITE_ADMIN_REMOVE: `${prefix} site admin remove`,
SITE_ALERT_GET: `${prefix} site alert get`,
SITE_ALERT_LIST: `${prefix} site alert list`,
SITE_APPCATALOG_ADD: `${prefix} site appcatalog add`,
SITE_APPCATALOG_LIST: `${prefix} site appcatalog list`,
Expand Down
Loading