Auto Approving Documents in SharePoint Document Library

Ok so this sounds kinda strange right? You ask the question why would you want to auto-approve documents in a library where there is approval set on the document library.

Well my scenario is this, I have project documents some which need approving and then some that don’t. I hear you say why not just have 2 document libraries for this, well I could but I setup some views to group the documents by content types / columns and to avoid customising SharePoint by creating a content query web part with custom XSLT I looked into using a SharePoint Designer workflow to accomplish this.

The other thing to remember here is that I have setup the document library to only show readers major versions of documents to readers of the document library. I also have the require checkout before editing the document enabled. See the screenshot below for advanced settings for the library:

image

So I have indentified specific content types that do not require approving and need to auto approve these documents. My challenge here is that once the workflow tries to change the document to ‘Approved’ it may see that the document has been modified and then change it back to ‘draft’, the document also needs to be checked out to make this change so this could cause a problem.

So below shows the step I created to attempt to update the approval status.

image

So here was the first attempt at running the workflow which failed due to the document not being checked out

image

So adding check out and check in around the update of the approval status is the next logical step.

image

And this was the error I got – unknown error – very helpful!

image

So I concluded that the only way to do this was to set ‘Require Check Out’ to ‘No’ under version settings for the document library.

image

And…. It worked - success!

So to conclude you can’t auto approve certain content types in a document library with ‘Require Check Out’ enabled for the document library. From a business impact disabling this option could result in multiple people editing the same document so this would need to be considered vs. the inconvenience of documents remaining in draft when they don’t need approval.

1 comments:

Hamidreza Alvandi said...

Thank you you give me a great idea to solving my problem

Post a Comment