Module Name | schema | applicable | online version | external help file | title |
---|---|---|---|---|---|
PnP.PowerShell |
2.0.0 |
SharePoint Online |
PnP.PowerShell.dll-Help.xml |
Add-PnPListItemAttachment |
Adds an attachment to the specified list item in the SharePoint list
Add-PnPListItemAttachment [-List] <ListPipeBind> [-Identity] <ListItemPipeBind> [-Path <String>] [-NewFileName <String>] [-Connection <PnPConnection>]
Add-PnPListItemAttachment [-List] <ListPipeBind> [-Identity] <ListItemPipeBind> [-FileName <String>] [-Stream <Stream>] [-Connection <PnPConnection>]
Add-PnPListItemAttachment [-List] <ListPipeBind> [-Identity] <ListItemPipeBind> [-FileName <String>] [-Content <text>] [-Connection <PnPConnection>]
This cmdlet allows adding a file as an attachment to a list item in a SharePoint Online list.
Add-PnPListItemAttachment -List "Demo List" -Identity 1 -Path c:\temp\test.mp4
Adds a new attachment to the list item with Id "1" in the "Demo List" SharePoint list with file name as test.mp4 from the specified path.
Add-PnPListItemAttachment -List "Demo List" -Identity 1 -FileName "test.txt" -Content '{ "Test": "Value" }'
Adds a new attachment to the list item with Id "1" in the "Demo List" SharePoint list with file name as test.txt and content as specified.
Add-PnPListItemAttachment -List "Demo List" -Identity 1 -FileName "test.mp4" -Stream $fileStream
Adds a new attachment to the list item with Id "1" in the "Demo List" SharePoint list with file name as test.mp4 and content coming from a stream.
Specify text of the attachment for the list item.
Type: String
Parameter Sets: (Upload file from text)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The local file path
Type: String
Parameter Sets: (Upload file)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Filename to give to the attachment file on SharePoint
Type: String
Parameter Sets: (Upload file)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Filename to give to the attachment file on SharePoint
Type: String
Parameter Sets: (Upload file from stream, Upload file from text)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Stream with the file contents
Type: Stream
Parameter Sets: (Upload file from stream)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The ID, Title or Url of the list. Note that when providing the name of the list, the name is case-sensitive.
Type: ListPipeBind
Parameter Sets: (All)
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
The ID of the listitem, or actual ListItem object to add the attachment to.
Type: ListItemPipeBind
Parameter Sets: (All)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False