Вопрос

Is there a way to approve a document in a document library by using only SharePoint 2013 workflows in SharePoint Designer 2013? This is possible using SharePoint 2010 workflows however these features were removed from SharePoint 2013 workflows (e.g. the Set Content Approval Status and similar actions have been removed. See What's changed in SharePoint Designer 2013).

All solutions that I have found involve creating both a SharePoint 2010 workflow and SharePoint 2013 workflow, and then using "Start a list workflow" within the 2013 workflow to start the 2010 workflow. Given that the 2010 workflows are deprecated, I would rather create new workflows without them (see the solution to How to create your own approval custom workflow in spd 2013?).

I've tried creating a 2013 workflow and then using the "Update list item" action but this doesn't seem to give access to the "Approval Status" of the document library.

What am I missing?

Это было полезно?

Решение

It is possible to approve documents using only SharePoint 2013 workflows by using the 'Call HTTP web service' action and then making a call to the SharePoint 2013 REST API (see the File Approve method in the REST API reference on MSDN):

  1. Add action 'Build Dictionary'
  2. Add an item to the dictionary with the following properties:

    Name: 'Accept'
    Type: 'String'
    Value: 'application/json; odata=verbose'
    
  3. Output to 'Variable: header'

  4. Add action 'Call HTTP web service'

  5. Right-click the action and select properties

  6. Set as follows:

    Address: http://server/subsite/_api/web/getfilebyserverrelativeurl('/subsite/Shared Documents/test.docx')/approve('Enter your approval comments here')
    Request Type: HTTP POST
    Request Headers: Variable: header
    
Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top