Usage
m365 spo listitem attachment add [options]
Description
Adds an attachment to 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. |
-p, --filePath <filePath> |
Local path to the file that will be added as an attachment to the list item. |
-n, --fileName [fileName] |
Name for the file. If no name is provided, the name from filePath will be utilized. |
Examples
Add a new attachment to a list item from a local file by using list title
m365 spo listitem attachment add --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "Demo List" --listItemId 147 --filePath "C:/Reports/File1.jpg"
Add a new attachment to a list item from a local file by using list URL with a different filename
m365 spo listitem attachment add --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl "/sites/project-x/Lists/DemoList" --listItemId 147 --filePath "C:/Reports/File1.jpg" --fileName "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
Usage
m365 spo listitem attachment add [options]
Description
Adds an attachment to a list item
Options
-u, --webUrl <webUrl>--listId [listId]listTitle,listIdorlistUrl.--listTitle [listTitle]listTitle,listIdorlistUrl.--listUrl [listUrl]listTitle,listIdorlistUrl.--listItemId <listItemId>-p, --filePath <filePath>-n, --fileName [fileName]filePathwill be utilized.Examples
Add a new attachment to a list item from a local file by using list title
Add a new attachment to a list item from a local file by using list URL with a different filename
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