spo listitem attachment list
Gets the attachments associated to a list item
Usage
m365 spo listitem attachment list [options]
Options
-u, --webUrl <webUrl>URL of the site from which the item should be retrieved
--listId [listId]ID of the list where the item should be retrieved. Specify either
listTitle,listIdorlistUrl--listTitle [listTitle]Title of the list where the item should be retrieved. Specify either
listTitle,listIdorlistUrl--listUrl [listUrl]Server- or site-relative URL of the list. Specify either
listTitle,listIdorlistUrl--itemId <itemId>ID of the list item to in question
-h, --help [help]Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options,examples,remarks,response,full. Default isfull.--query [query]JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]Output type.
json,text,csv,md. Defaultjson.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Examples
Gets the attachments from list item with itemId 147 in list with title Demo List in site https://contoso.sharepoint.com/sites/project-x
m365 spo listitem attachment list --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "Demo List" --itemId 147
Gets the attachments from list item with itemId 147 in list with id 0cd891ef-afce-4e55-b836-fce03286cccf in site https://contoso.sharepoint.com/sites/project-x
m365 spo listitem attachment list --webUrl https://contoso.sharepoint.com/sites/project-x --listId 0cd891ef-afce-4e55-b836-fce03286cccf --itemId 147
Gets the attachments from a specific list item in a specific list obtained by server-relative URL in a specific site
m365 spo listitem attachment list --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl /sites/project-x/Documents --itemId 147
Response
- JSON
- Text
- CSV
- Markdown
[
{
"FileName": "DummyDocument.docx",
"FileNameAsPath": {
"DecodedUrl": "DummyDocument.docx"
},
"ServerRelativePath": {
"DecodedUrl": "/Lists/Test/Attachments/236/DummyDocument.docx"
},
"ServerRelativeUrl": "/Lists/Test/Attachments/236/DummyDocument.docx"
}
]
FileName ServerRelativeUrl
------------------ ----------------------------------------------
DummyDocument.docx /Lists/Test/Attachments/236/DummyDocument.docx
FileName,ServerRelativeUrl
DummyDocument.docx,/Lists/Test/Attachments/236/DummyDocument.docx
# spo listitem attachment list --webUrl "https://contoso.sharepoint.com" --listTitle "Test" --itemId "236"
Date: 2/20/2023
Property | Value
---------|-------
FileName | DummyDocument.docx
FileNameAsPath | {"DecodedUrl":"DummyDocument.docx"}
ServerRelativePath | {"DecodedUrl":"/Lists/Test/Attachments/236/DummyDocument.docx"}
ServerRelativeUrl | /Lists/Test/Attachments/236/DummyDocument.docx