Posts

Showing posts from May, 2018

Workflow runs twice

I came across an issue with a Visual Studio declarative workflow running twice on a library and I have configured the workflow to run on change event. Initially I thought there might be an issue with VS workflow, and then I have created a SharePoint designer workflow but the issue remains same. I was clueless. I have one more workflow, that is also running on change for another library and there were no issues with that. Then I tried to compare both libraries and found that versioning is enabled on problematic library and no versioning enabled for other library. If I disable versioning, the workflow runs only once. That's strange. I am completely clueless what's happening internally. What my guess is that the workflow running on item check-in event and item updated event. After doing lot of research, finally I found a workaround that worked very well for me. At the end of the workflow I have paused the workflow for 1 minute. Surprisingly, it has resolved my problem.

SharePoint 2013 workflow REST API unauthorized error

When we write a workflow that calls SharePoint or non-SharePoint HTTP (REST) web service from SharePoint workflow, "Authorization: Bearer" is added to HTTP header by default, which may sometimes result in " 401 Unauthorized " error response. Following workaround can be followed to avoid this error. Add "Authorization" field set with empty string ("") in a "RequestHeader" property of "Call HTTP Web Service" action in case of SharePoint designer workflow and "HttpSend" action in case of Visual studio workflow. In case of SharePoint on-premise, we also need to grant full access to workflow service account (given while configuring workflow manager) at web application level (Web application --> User Policy).