Hi @Xav
Would you mind using the c# graph sdk? I don't do much research on powershell script, I use c# code to batch delete all items of a specific list of a specific site and it works fine. refer to:
using Azure.Identity;
using Microsoft.Graph;
var scopes = new[] { "https://graph.microsoft.com/.default" };
var tenantId = "tenant id";
// Values from app registration
var clientId = "client id";
var clientSecret = "client secret";
// using Azure.Identity;
var options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
// https://learn.microsoft.com/dotnet/api/azure.identity.clientsecretcredential
var clientSecretCredential = new ClientSecretCredential(
tenantId, clientId, clientSecret, options);
var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
var items = await graphClient.Sites["site id"].Lists["list id"].Items
.Request()
.GetAsync();
for (int i = 0; i < items.Count; i++)
{
var ids = items[i].Id.ToString();
await graphClient.Sites["site id"].Lists["list id"].Items[ids]
.Request()
.DeleteAsync();
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.