none
How do I create a REST call in SharePoint 2013 Designer to delete records from the Workflow History List? RRS feed

  • Question

  • I use the Workflow History List for debugging and the option of turning on debugging for flows that are in production.  I would however like a workflow that purges the records in this list based by the workflow Name.  I have created a workflow and a Delete HTTP request, but can't get it to work.  I can't find any documentation on how to do this.  What I have is

    [%Workflow Context:Current Site URL%]/_api/lists/GetByTitle('Workflow History')?$select=Id as my String in my Call

    I get the following response code, response=PreconditionFailed


    Tuesday, May 21, 2019 4:06 PM

All replies

  • Hi Harvan,

    You could try this:

    Set RequestType to HTTP POST. In your header dictionary, add the X-HTTP-Method header and set its value to DELETE. And also add the IF-MATCH header and set its value to *.

    References:

    https://sharepoint.stackexchange.com/questions/181522/workflow-to-delete-list-item-on-subsite-sharepoint-designer-call-http-web-servi

    http://codelesssharepointinfopath.com/workflow-useful-rest-calls-listing-views-and-deleting-them/

    Best Regards,

    Michael Han


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, May 22, 2019 8:35 AM
  • Well reading both the references, I still am not certain how to proceed.  What I did do is create 3 dictionary's (all fields are stings)

    1.  requestHeaders that has Accept and Content-Type as both set to application/json;odata=verbose

    2.  MetaData that has Type set as SP.Data.TestListItem

    3.  Dictonary that has X-HTTP-Method set as DELETE

    ============================================
    I think I'm getting it, but still don't know how to put the pieces together.  My understanding now is that I create a HTTP Rest to select the IDs of each record.  This I got.
    Then I have to follow it with two more HTTP requests one to get the item and the other to delete the item.  It is these later two that I don't know how to do.  Am I on the right track?



    • Edited by SSHarvancik Wednesday, May 22, 2019 9:06 PM Finally found some tidbits
    Wednesday, May 22, 2019 2:17 PM