pnpcore icon indicating copy to clipboard operation
pnpcore copied to clipboard

Ability to batch FileCollection.AddSync

Open wizofaus opened this issue 4 months ago • 2 comments

Category

  • [x] Feature request

Describe the feature

Would like the ability to easily upload multiple files in parallel or as a batch via FileCollection.AddAsync( ).

Describe the solution you'd like

There doesn't seem to be any reason the /files/addusingpath API can't be done as part of a batch (though I'd agree for very large files it would be problematic), but at any rate it's definitely useful for a client to be able to efficiently upload multiple files (esp. if they have a particular folder structure, e.g. sync-ing an entire local directory to SharePoint) without having to do them one by one. This is in fact exactly what the SharePoint frontend does (I haven't checked if the JS PnP library supports this).

Ideally just the ability to specify a list of server-relative url and + binary content stream pairs, and some straightforward way of waiting for all uploads to complete and collate any errors that might occur.

However, I would also like the ability to update column values for a just-uploaded document as part of a batch operation (I don't want the document to be visible to any event receivers or other applications until the column values are updated). CSOM can do this using FileCreationInformation so I assume it's possible using the REST API.

Additional context

wizofaus avatar Feb 19 '24 22:02 wizofaus