pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
896 stars 318 forks source link

new command: spo listitem batch remove #5688

Closed brugh closed 3 months ago

brugh commented 9 months ago

Usage

m365 spo listitem batch remove [options]

Description

Removes items from a list in batch

Options

Name Description
-u, --webUrl <webUrl> URL of the SharePoint site.
-l, --listId [listId] ID of the list. Specify either listTitle, listId, or listUrl, but not multiple.
-t, --listTitle [listTitle] Title of the list. Specify either listTitle, listId, or listUrl, but not multiple.
--listUrl [listUrl] Server- or site-relative URL of the list. Specify either listTitle, listId, or listUrl, but not multiple.
-p, --filePath [filePath] The absolute or relative path to a flat CSV file containing the list items. Specify either filePath or ids but not both.
-i, --ids [ids] Comma separated list of list item IDs. Specify either filePath or ids but not both.
--recycle Recycle the list items. Otherwise, they will be permanently deleted.
-f, --force Don't prompt for confirmation.

Examples

Remove a list of IDs from a list with a csv

m365 spo listitem batch remove --filePath ./IDlist.csv --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "Demo List"

Remove a list of IDs from a list by specifying the IDs

m365 spo listitem batch remove --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "Demo List" --ids "123,234,345"

Remarks

A sample CSV can be found below. The first line of the CSV-file should contain the internal column names that you wish to set.

ID
5
6
12

Response

The command won't return a response on success.

milanholemans commented 9 months ago

Hi @brugh thank you for this suggestion, I think this command could be really useful together with the spo listitem batch add and spo listitem batch set command.

Few things to change in the spec:

Also, let's update the specs to something like:

Name Description
-u, --webUrl <webUrl> URL of the SharePoint site.
-l, --listId [listId] ID of the list. Specify either listTitle, listId, or listUrl, but not multiple.
-t, --listTitle [listTitle] Title of the list. Specify either listTitle, listId, or listUrl, but not multiple.
--listUrl [listUrl] Server- or site-relative URL of the list. Specify either listTitle, listId, or listUrl, but not multiple.
-p, --filePath [filePath] The absolute or relative path to a flat CSV file containing the list items. Specify either filePath or ids but not both.
-i, --ids [ids] Comma separated list of list item IDs. Specify either filePath or ids but not both.
--recycle Recycle the list items. Otherwise, they will be permanently deleted.
-f, --force Don't prompt for confirmation.
milanholemans commented 7 months ago

@brugh are you still willing to finetune this spec?

brugh commented 7 months ago

ah yes, if I can help, sure. I agreed with your suggestion which would work fine for me. What part would you like to have me finetune?

milanholemans commented 7 months ago

If you agree, could you implement my suggestions in the spec? Also, could you:

brugh commented 6 months ago

If you agree, could you implement my suggestions in the spec? Also, could you:

ok, i changed the request to include your suggestions

MathijsVerbeeck commented 6 months ago

Can I work on this?