SOLVED

Using ListItemAttachments (pnp) - I don't know how to use it!

Brass Contributor

I need to make a file upload to an SPO list for an SPFX web part form I'm making.

I've put this into my JSX:

 

<ListItemAttachments listId='23083058-4496-4367-9692-0c6fc430cce0'
                     itemId={1}
                     context={this.props.context}
                     disabled={false} 
                     
                     />

 

 

How do you use it? I understand that this may be something that lists existing attachments, so in my case, because the form hasn't submitted anything yet, the item doesn't exist to hold an item. Despite that, my form allows clicking on existing items, WITH ATTACHMENTS, but still doesn't work and gives the same error when I go to the page with the ListItemAttachments field.

Is there anything that I can use for just a simple upload attachment folder that will show the existing attachment when a user opens up and existing item?

 

1 Reply
best response confirmed by Cardinal_Night (Brass Contributor)
Solution

@Cardinal_Night The control works under the assumption that an item has been created already. You would need to create an item first,and pass that ID to the ListItemAttachments control.

1 best response

Accepted Solutions
best response confirmed by Cardinal_Night (Brass Contributor)
Solution

@Cardinal_Night The control works under the assumption that an item has been created already. You would need to create an item first,and pass that ID to the ListItemAttachments control.

View solution in original post