web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply a retention labe...
Power Automate
Unanswered

Apply a retention label on the item failed - The reponse is not in JSON Format

(0) ShareShare
ReportReport
Posted on by 121

Hi Everyone, 

I had an issue with power automate when I use this action "Apply a retention policy on the item"Altharus_1-1697443352805.png

I configure all of is needed but when i testing the flow , i have a issue " The reponse is not in JSON Format"

 

Do you already have this issue when you trying to apply a label retention on an item?

 

Altharus_0-1697443895434.png

 

Altharus_0-1697443247539.png

 

Best regards, 

 

Categories:
  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @Altharus,


    It looks like the ID of your item you want to apply the label to is missing in your configuration. Strange that Microsoft did not make that field of the action mandatory 😅

     

    Without it I would assume the action would not know which item to tag at all 😂

     

    Below is an example of my test (which worked without an issue)

     

    1. Available tags (after creation of the label in Purview and publishing them to my destination site). 

     

    retentionlabel_apply.png

     

    2. The Folder Path and the ID of the item I want to tag

     

    id_retention.png

     

    3. The flow configuration

     

    example_retentionlabel.png

     

    4. The flow run, which succeeded

     

    hold_example.png

     

    5. The end result, a retention label applied to a single item (Test.docx)

     

    hold_example02.png

  • Altharus Profile Picture
    121 on at

    i'll testing that , i'm back to tell you if it's works 🙂

     

    Thanks

     

    my other question is , I need to apply a retention label for all items in my librairies , how can I do that .

     

    I need to get all ID of the items on the librairy but , i don't know how make this action

  • Altharus Profile Picture
    121 on at

    Unfortunately , i have the same issue 😞

    I have tested with differents Path

    Altharus_0-1697451122635.png

     

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @Altharus,

     

    In that case I would suggest to use a Send an HTTP request action to retrieve all the ids (you could even use a filter to only retrieve items without a label) and after that use a send an http request to tag in bulk.

     

    Martin Lingstuyl has a nice blog about tagging in bulk:

    https://www.blimped.nl/managing-and-applying-purview-retention-labels-using-code#2-using-the-sharepoint-rest-api-through-the-bulk-endpoint

     

    Below is an example

     

    Uri for finding items without a retention label

     

    _api/v2.1/sites/@{variables('SiteId')}/lists/@{variables('ListId')}/items?$filter=fields/_ComplianceTag eq null&$select=id

     

     

    A Select action is used to create an array of ids.

     

    outputs('Send_an_HTTP_request_to_SharePoint')?['body']['value']

     

     

    Map field (with is switched to text mode with the button on the right side)

     

    int(item()['id'])

     

     

    Uri for applying the labels

     

    _api/SP_CompliancePolicy_SPPolicyStoreProxy_SetComplianceTagOnBulkItems

     

     

    Body

    {
     "listUrl": "https://contoso.sharepoint.com/sites/InPlaceRecordManagement/Hold",
     "complianceTagValue": "RecordManagementLabel",
     "itemIds": @{body('Select')}
    }

     

    listurl_bulkitemstagging.png

     

  • Altharus Profile Picture
    121 on at

    Thanks i check that but , how to get Siteid and Listid?

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @Altharus,

     

    The quickest way to find the siteId is probably logging on to the Graph Explorer site and search for your site  (https://aka.ms/ge).

     

    akamsge.png

     

    The list id can be found in the settings of the library.

     

    settings_listid.png

     

     

     

    If you want to dynamically retrieve those siteid and listid values you could use a couple of additional HTTP request actions for this as well. I have a couple of blogs about that:

    https://www.expiscornovus.com/2023/05/04/get-id-of-site/

    https://www.expiscornovus.com/2023/05/04/get-id-of-list/

     

  • Altharus Profile Picture
    121 on at

    it's not working on my side , there is an issue .

     

    that is drive me crazy 😄

    Altharus_2-1697469816590.png

     

    Altharus_1-1697469772699.png

     

    Altharus_0-1697469697503.png

     

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @Altharus,

     

    In the site address of the second HTTP request I used the target site, not the SPO admin centre url, can you change that?

     

    And what is the listurl property value you used in the second HTTP request?

     

    Can you also make sure you can manually assign the same test retention label via the interface to that same item with id 1? Just to rule out that it is not a permission or retention label policy issue. 😁

  • Altharus Profile Picture
    121 on at

    Thanks for your reply , i’m not front of my pc , i testing that as soon as possible and i’m Back to you 

  • Altharus Profile Picture
    121 on at

    it's works 😄 

    really thanks @Expiscornovus 

     

    Altharus_0-1697473522422.png

    that is apply a rention label for all librairies or list ?

     

    I need to apply that on all my SP tenant , it's possible ? 

     

    I can use the same actions ?

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard