skip cleanup of hidden list (#4934)

skips cleanup of hidden list considering them system generated and delete attempt for them would result in graph error `General exception while processing` 

list details response for list `Corso_Restore_23-Dec-2023_14-54-05_Sharing Links` of 'hidden' type
```
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('4892edf5-2ebf-46be-a6e5-a40b2cbf1c1a')/lists/$entity",
    "@odata.etag": "\"35697c04-415d-44ad-b328-527e32a20126,1\"",
    "createdDateTime": "2023-12-23T14:54:36Z",
    "description": "Use this list to track documents which have internal or anonymous sharing links in the site.",
    "eTag": "\"35697c04-415d-44ad-b328-527e32a20126,1\"",
    "id": "35697c04-415d-44ad-b328-527e32a20126",
    "lastModifiedDateTime": "2023-12-23T14:55:07Z",
    "name": "Corso_Restore_23Dec2023_145405_Sharing Links",
    "webUrl": "https://10rqc2.sharepoint.com/sites/CorsoCI/Corso_Restore_23Dec2023_145405_Sharing%20Links",
    "displayName": "Corso_Restore_23-Dec-2023_14-54-05_Sharing Links",
    "createdBy": {
        "user": {
            "displayName": "SharePoint App"
        }
    },
    "parentReference": {
        "siteId": "10rqc2.sharepoint.com,4892edf5-2ebf-46be-a6e5-a40b2cbf1c1a,38ab6d06-fc82-4417-af93-22d8733c22be"
    },
    "list": {
        "contentTypesEnabled": false,
        "hidden": true,
        "template": "sharingLinks"
    }
}
```

#### Does this PR need a docs update or release note?
- [x]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 💻 CI/Deployment

#### Issue(s)
https://github.com/alcionai/corso/actions/runs/7312141926/job/19922423733

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💚 E2E
This commit is contained in:
Hitesh Pattanayak 2023-12-24 10:25:10 +05:30 committed by GitHub
parent 87e41b20e0
commit 95dab16f67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,6 +182,14 @@ function Delete-LibraryByPrefix {
if ($PSCmdlet.ShouldProcess("Name: " + $l.Title + "Remove folder")) {
Write-Host "Deleting list: "$l.Title
try {
$listInfo = Get-PnPList -Identity $l.Id -Fields Hidden
# Check if the 'hidden' property is true
if ($listInfo.Hidden) {
Write-Host "List: $($l.Title) is hidden. Skipping..."
continue
}
Remove-PnPList -Identity $l.Id -Force
}
catch [ System.Management.Automation.ItemNotFoundException ] {