Skip to content

New command: spo listitem attachment remove #5220

@Jwaegebaert

Description

@Jwaegebaert

Usage

m365 spo listitem attachment remove [options]

Description

Removes an attachment from a list item

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the listitem is located.
--listId [listId] ID of the list. Specify either listTitle, listId or listUrl.
--listTitle [listTitle] Title of the list. Specify either listTitle, listId or listUrl.
--listUrl [listUrl] Server- or site-relative URL of the list. Specify either listTitle, listId or listUrl.
--listItemId <listItemId> The ID of the list item.
-n, --fileName <fileName> Name of the file to remove.
--confirm Don't prompt for confirmation.

Examples

Remove an attachment from a list item using list tile.

m365 spo listitem attachment remove --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "Demo List" --listItemId 147 --fileName "File1.jpg"

Remove an attachment from a list item using list URL

m365 spo listitem attachment remove --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl "/sites/project-x/Lists/DemoList" --listItemId 147 --fileName "File1.jpg"

Additional Info

More info regarding the SP REST endpoint to use: https://learn.microsoft.com/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest#working-with-files-attached-to-list-items-by-using-rest

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions