As you can imagine, a top-notch web site like mine gets a lot of traffic. Sometimes those people leave me comments. Usually to tell me I’ve typoed the name of a Netcast, or that I’m flat out wrong about something. The important thing is that they care enough to leave comments. There is another, darker, evil group of people that leave comments on my blog. Spammers. We hate them. To discourage spammers from leaving comments on my blog I’ve taken two steps. First, I require a valid date to be entered for a comment to go through. Second, I require each comment be lovingly approved by yours truly before it shows up. That way if a spam comment sneaks through I can delete it before it shows up. It also gives me the opportunity to edit out any unflattering things that might accidently get submitted. Together I think these do a pretty good job of keeping the riff-raff out. There is one downside to all these hoops, when I submit my own comments in reply to other comments I have to approve them too. If only there was a way for SharePoint to know that any comment posted by me was pure gold and should be approved automatically. Oh wait, there is…
Oddly enough, laziness is a great motivator. My hatred for approving my own comments forced me outside of my comfortable IT Pro box and into the scary realm of end userdom. I decided that a workflow was the easiest way to accomplish this. First, let’s identify the enemy:
That’s just unacceptable. The first step to my remedy is to fire up SharePoint Designer and open up my site and then open the Comments list.
After your list is open, go to the lower right corner to the Workflows section and click New:
I called the workflow “Auto approve TK’s comments.” I recommend you do the same.
After the workflow is created, you need to add a condition for the workflow. This is how it figures out whether to act or not. Since this workflow needs to determine if I’m the one submitting the comment, the condition I used is “Created by a specific person.”
After the condition is created we need to define it. Click “specific person” and either type the username in, or pick it from the list:
Next we need to assign and action to our condition. The action I used was “Set Content Approval Status.”
After the action was added, I clicked “this status” and selected “Approved.”
It may seem like that’s all we need to do, but there’s a couple more very important steps. First, we need to tell SharePoint to run this workflow automatically when a new item is created. In this case when a new comment is added. Go back to the workflow’s settings page and click “Start workflow automatically when an item is created.”
The final step is to save and publish the workflow to our list:
That’s all there is to it.
Now when I submit a comment to my blog the workflow runs and automatically approves it. No more of that pesky clicking for me.
Hope someone can make use of this.