SharePoint Saturday NYC Wrap-up

I was very fortunate to have been selected to speak at this year’s SharePoint Saturday New York City and had an awesome crowd!

The slides & code from my session can be found here on Github.

I would also like to highlight a couple of other sessions that I attended..

Enterprise JavaScript Development Patterns – this was a session put on by Rob Windsor who is a popular Pluralsight author and SharePoint MVP talking about moving beyond just basic client side scripts on a page and really focusing on building full-fledged applications in JavaScript. As usual, Rob’s session was very code focused but absolutely priceless for those getting into JavaScript development.

EmberJS & SharePoint Applications – this was a very cool session given by Greg Hurlman who is an independent software developer. His topic on Ember.JS is perfect for those who are already doing JavaScript development but would like to take their applications to the next level by leveraging an MVC framework. When I get a bit more time I would like to try my hand at working with Ember.


SharePoint Saturday Boston Wrap-up

I had a blast this past weekend at SharePoint Saturday Boston. This was my third time attending and first as a speaker. It was a beautiful day in Boston and I had a really great group attending my session.

As promised here are the slides from my session: “MacGyvering a SharePoint Work Request Process for Power Users!”

Matfess – MacGyvering.pptx

Thanks to all those who came out – I had a blast!

Using SharePoint’s Call a Web Service action to Retrieve data from WordPress and Loop through the results

Last week I had the pleasure of presenting at the CT SharePoint User’s Group on “MacGyvering an Intake Process for Power Users” and I included a demo of SharePoint 2013’s call a web service action. Of course the Demo God’s took over and my workflow got stuck on starting. In true SharePoint form, I got home that evening and tried again and it worked perfectly. I hadn’t run across many examples of looping through non-SharePoint data sources, so I figured it would be cool to document my steps and share with anyone interested.

So crack open a brand new SharePoint Designer 2013 Workflow and follow along!

1. Create a new Dictionary variable called requestHeaders with two entries

Name: Accept
Type: String
Value: application/json;odata=verbose

Name: Content-Type
Type: String
Value: application/json;odata=verbose

2. Add a Call HTTP Web Service action to your workflow.

3. This is where you will want to deviate a bit from my example. So I decided to go with a very simple example of grabbing all of my blog posts for my Word  Press blog. I’m not going to cover it all here, but basically you should head over to WordPress and take a look at their REST API’s documentation for all the cool stuff you can get at – but for now, let’s just go after posts.

Here’s my URL for the Call HTTP Service action:

4. Right click on the call web service action in your workflow:
Select properties and you’ll want to set the following:

RequestHeaders – Variable:requestHeaders (Dictionary)
ResponseContent – Variable:JSONResults (Dictionary)
ResponseHeaders – Variable: requestHeaders (Dictionary)
ResponseStatusCode – Variable: responseCode (String)

*Please note you’ll need to create these variables*

5. Next you’ll want to figure out how many results your web service call retrieved. I personally like to create a step to store these next few steps but it’s up to how you want to organize your workflow. At this point, you’ll add a “Get an Item from a Dictionary” action to your workflow. In order to figure out what you’re doing to get from the Dictionary, you’ll want to understand what Word Press is returning from your REST call. Here’s a screenshot I took of what is returned from my call to grab all my blog posts. Ironically enough, each entry is stored under “posts” which is what you’ll want to retrieve in this next step.


So your step should match the below – you’re going to Get posts from Variable:JSONResults and output to a new Dictionary variable called dataset.

6. Next, add a Count Items in a Dictionary action. Pass it the variable: dataset and output to an Integer variable called resultsCount.

7. This next step isn’t always documented which got me stuck when I first tried to loop through the results from a web service. I had to recall my CS110 course where I first learned how to create a loop in C++, I needed a LoopCounter variable to help iterate through the collection results. In C++ this would have been my variable i so I could i++, in the land of SharePoint, I’m going to use an Integer Variable called LoopCounter.


Initialize your LoopCounter variable to 0.

8. Now you’ll want to add your Loop with Condition action to your workflow. I’m going to show you what mine looks like then break it down piece by piece.

loop step

8a. You’ll first set the condition so that the Loop with run while your LoopCounter variable is less than the resultsCount variable. Since you’re starting at 0, it’ll break out of the loop once you have reached the same count as the number of items you have retrieved.

8b. Add a “Get item from Dictionary” action and this is where you’ll put the posts([%Variable: LoopCounter%]) which is basically you retrieving each results from the JSONResults Dictionary. You’ll then output that to yet another Dictionary – I called mine ResultItem. Basically this variable has all the details for each result (in my case the post title, URL, etc)

I’m going to refer you again to the JSON results which gives you the parameter name for everything in your results item. The two parameters I want to grab are title & guid – title is obviously what I called my blog post, and the guid is the URL. Kind of strange they didn’t call it URL, but whatever.

9. So you’ll add a few more “Get Item from Dictionary” actions – mine were to get the title & guid and then output them to a variable. If you just want to re-display, make them string variables.Basically, I’ll give you the advice to consider what you’re retrieving and then set the appropriate variable to take action upon that. If I was pulling back a number parameter, I might store it to an Integer variable, etc..

10. Now you can choose to do whatever you want with these new variables. For simplicity sake, I’ll just log the values to be displayed in the workflow history.

11. Once you’re done playing with variables – don’t forget to increment your Loop Counter. Insert a Do Calculation action, pass the LoopCounter variable, and have it output to an Integer variable. I called mine calc1 – but you can call it whatever you would like.

12. Assign the value of LoopCounter to calc1 (basically it’s LoopCounter++ – increment by one)

13. That’s it! Test your workflow out and have some fun..

14. (Extra Credit) have your workflow create a new list item using the variables you grab – so for this example the Title + GUID..

Example of writing title to workflow history


Summary: This post is hopefully helpful at demonstrating how to use SharePoint 2013’s Loop function along with the Call a Web Service action. This functionality is pretty powerful, as you can see it even stretches beyond the limits of SharePoint. The one key point to using Word Press as a data source is that the API accepts anonymous requests. Remember that workflows run as the user who initiates it unless you include App Steps (whole different blog post)

SPS Albany Slides

I had an absolute blast this past weekend at SharePoint Saturday Albany, and was very fortunate to be able to present. The weather was great and it was awesome getting to hang with the speakers the night before. I feel like I made some new friends and got to spend some quality time with some old friends. It was a great experience, and I hope to continue having the opportunity to speak at future SharePoint Saturdays.

For anyone looking, here’s a copy of my slides Case Study: United Technologies Corporation. “The 10 things we did to secure SharePoint collaboration”.