我有以下 C# 代码,我在
SecondStage
RecycleBin 中有大约 70 万个项目。任何帮助都会非常可观。
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using PnP.Framework;
internal class Program
{
private const string clientId = "<MyClientId>";
private static async Task Main(string[] args)
{
var connection = AuthenticationManager.CreateWithInteractiveLogin(clientId, (url, port) =>
{
var psi = new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
};
Process.Start(psi);
});
var clientContext = await connection.GetContextAsync("https://<MyTenant>.sharepoint.com/personal/<MyAdminUser>/");
var items = clientContext.Site.GetRecycleBinItems(null,
1, false,
RecycleBinOrderBy.DefaultOrderBy, RecycleBinItemState.SecondStageRecycleBin);
clientContext.Load(items);
await clientContext.ExecuteQueryRetryAsync();
var item = items.First();
item.Restore();
await clientContext.ExecuteQueryAsync(); //Here the error is thrown
}
}