New command: Removes a sensitivity label from a file
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 413
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 21
Description
Usage
m365 spo file sensitivitylabel remove
Description
Removes a sensitivity label from a file
Options
| Option | Description |
|---|---|
-u, --webUrl <webUrl> |
URL of the site where the file is located |
-t, --listTitle [listTitle] |
The title of the library where the file is located. Specify either listTitle, listId, or listUrl but not multiple. |
-l, --listId [listId] |
The ID of the library where the file is located. Specify either listTitle, listId, or listUrl but not multiple. |
--listUrl [listUrl] |
Server- or web-relative URL of the library where the file is located Specify either listTitle, listId, or listUrl but not multiple. |
-f, --fileUrl [fileUrl] |
the URL of the file where the label should be removed. Specify either fileUrl or fileId but not both. |
--fileId [fileId] |
The UniqueId (GUID) of the file where the label should be removed. Specify either fileUrl or fileId but not both. |
--confirm |
Don't prompt for confirmation. |
Examples
Removes a sensitivity label based on the file url
m365 spo file sensitivitylabel remove --webUrl 'https://contoso.sharepoint.com' --libraryName 'Shared Documents' --fileUrl '/Shared Documents/Document.docx'
Removes a sensitivity label based on the file ID and don't prompt for confirmation
m365 spo file sensitivitylabel remove --webUrl 'https://contoso.sharepoint.com' --libraryName 'Shared Documents' --fileId '33f05b7a-c8d0-427d-8cc8-bceb11d33c30' --confirm
Default properties
No response
Additional Info
POST https://contos.sharepoint.com/_api/v2.1/drives/[Drive ID]/items/[Document ID]/setsensitivityLabel
with body:
{
"id": ""
}
This means we should retrieve 2 parameters:
- The SharePoint Drive ID of the Document Library, this can be done by doing:
GET https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com/drives
It seems that this endpoint doesn't accept the filter query parameter, so we should do an in code filter based on thelibraryNameoption - The document ID of the SharePoint file, this can be done by doing:
GET https://contoso.sharepoint.com/_api/web/GetFileByServerRelativePath(DecodedUrl=[File Url])or just use thefileIdoption
On success, the api will return a 200 response code with just an @odata.context property
Let's also add to the docs:
- Attention: This command is based on an API that is currently in preview and is subject to change once the API reached general availability.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation files or tests are named. Start with the command usage, options, examples, and Additional Info, then verify the SharePoint drive and file lookup details against the specified endpoints. Done means the new CLI command removes the label with URL or ID inputs, confirmation handling, tests, and the preview-API documentation note.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100