Skip to content

New command: spo listitem attachment set #5222

@Jwaegebaert

Description

@Jwaegebaert

Usage

m365 spo listitem attachment set [options]

Description

Updates an attachment from a list item

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the list item 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 update.
-p, --filePath <filePath> Local path used for updating the attachment contents.

Examples

Update an attachment from a list item by using list title

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

Update an attachment from a list item by using list URL

m365 spo listitem attachment set --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl "/sites/project-x/Lists/DemoList" --listItemId 147 --fileName "File1.jpg" --filePath "C:/Reports/File2.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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions