Share via

Error Applying Retention Label to SharePoint Document Library Using PnP PowerShell

Rahul 25 Reputation points
2025-07-17T07:14:08.0933333+00:00

Hi Community,

I'm trying to apply a retention label to a SharePoint Online document library using PnP PowerShell. Here's the command I'm using: Set-PnPRetentionLabel -List $libraryName -Label $retentionLabel -SyncToItems $true

Before this we were able to apply label by using same script.

However, I’m encountering the following error: Set-PnPRetentionLabel: Value cannot be null. Parameter name: Empty correlation Guid I've verified that both $libraryName and $retentionLabel are correctly populated. Has anyone encountered this issue before or can suggest what might be causing it?

I have also find a bug reported on here as well : Get-PnPLabel / Set-PnPLabel started throwing error after running fine for 2+ years · pnp/powershell · Discussion #5021 · GitHub

Thanks in advance for your help!

Microsoft 365 and Office | SharePoint | Development

1 answer

Sort by: Most helpful
  1. Rahul 25 Reputation points
    2025-07-28T06:27:01.43+00:00

    Hello All,

    Seems like MS rolled out fix to our Tenant and now our PnP script and C# code is working fine today.

    You can also check if in your tenant it is working or not. If not connect with MS to roll out this fix.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.