Error applying Retention Label to SharePoint online list/library Using CSOM C#

Deepak Namdeo 6 Reputation points
2025-07-25T04:36:51.7266667+00:00

Hi Community,

I have created one console utility to apply retention label to SharePoint Online list/library and it was working perferctly. Below is my code.


var applyToExistingItems = true; SPPolicyStoreProxy.SetListComplianceTag(clientContext, listRootFolder.ServerRelativeUrl, "Permanent (100 Years)", false, false, applyToExistingItems); clientContext.ExecuteQuery();


But from last week I am encountering below error while run my console utility to apply retention label.

Screenshot 2025-07-24 133135

Due you have suggestion what wrong with my code or any idea why I am encountering this issue with working code earlier.

I appreciate your help in advance!

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Nghia-P 2,520 Reputation points Microsoft External Staff Moderator
    2025-07-25T06:04:53.37+00:00

    Hi Deepak Namdeo

    Welcome to Microsoft Q&A Forum!

    Having a good day and I hope you doing well! 

    Thank you very much for sharing the details of the issue you’re experiencing with applying a Retention Label to your SharePoint Online library. I completely understand how disruptive and frustrating it can be when a process that previously worked smoothly suddenly encounters unexpected technical issues. 

    Based on my research, it appears that this situation is currently affecting a number of other users as well, so you are certainly not alone. There are ongoing discussions in the technical community about this specific problem, and it seems to be related to recent changes on Microsoft’s side. While there is no official confirmation from Microsoft yet, the pattern suggests this could be a system-related issue. 

    To help you move forward as quickly as possible, I recommend the following steps: 

    1. Check Service Health in Microsoft Admin Center: Please log in to your Microsoft 365 Admin Center

    • In the left menu, select Health > Service health
    • Here, you can check if there are any ongoing incidents or advisories related to SharePoint Online. Microsoft will post updates and estimated resolution times for any active issues. 

    2. Raise a Support Ticket with Microsoft: If you do not see any relevant incidents listed, I strongly encourage you to create a support ticket directly in the Admin Center for the fastest and most effective assistance. 

    • Go to Help & support > Contact support
    • Describe your issue in detail, for example: “Unable to apply Retention Label to SharePoint Online library. The error returned is: Value cannot be null. Parameter name: Empty correlation Guid.” 
    • Attach any relevant screenshots or error messages to help Microsoft’s support team understand the problem more quickly. 

    3. Monitor Community Discussions: You may also want to keep an eye on the Microsoft Tech Community forums, where other users and Microsoft experts are sharing updates and potential workarounds for this issue. 

    I will continue to monitor this situation closely and will update you immediately if I receive any new information from Microsoft or the community. Your patience and cooperation are greatly appreciated during this time. 

    If you need any further assistance or have any questions, please don’t hesitate to reach out to me at any time. I sincerely apologize for the inconvenience this issue has caused and truly appreciate your patience, effort, and perseverance while we work through this together. Your understanding and cooperation mean a lot to us, and I am here to support you every step of the way until the issue is fully resolved.


    If the answer is helpful, please click "Accepted 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.  


  2. Deepak Namdeo 6 Reputation points
    2025-07-30T07:46:44.05+00:00

    We are able to set Retention label through CSOM utility.

    Could you please share the RCA of the issue and after this you can close this ticket.


Your answer

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