How can I unpublish the current major version of the document as a part of a "suspend" workflow to ensure that regular users can't see it anymore?
Solved! Go to Solution.
If you publish the second to last major version of the document, the last version won't be published anymore and only users who are allowed to access history versions of the document will be able to see it.
Hope this helps
Thanks for your reply. What I wanted to achieve is that the document in general is not available to any user anymore. That's the reason why my workflow is creating a new draft version (which exclusively can be accessed by user hving the appropriate rights to see drafts) and set's it to "suspended". But then I somehow need to find a way to "unpublish" the last approved version (similar to that what I can do from within the document history). This means my workflow somehow needs to find the "current major version" (in the version list), select and unpublish it.
Means I don't want to have any published version anymore.
ok, if you're using SharePoint 2013, you can call a REST API request to do it.
I've written a blog on that : How to execute a REST API request with Nintex Workflow
To unpublish a document, you can call the following POST REST API request (Files and folders REST API reference ) - don't forget to get the request digest and add it as an header of the following request :
http://your_sharepoint_site_url/_api/web/getfilebyserverrelativeurl('/your_site/your_Library/your_filename.docx')/unpublish(comment='Check-in comment for the unpublish operation.')
Hope this helps