4848 Views
4 minutes read
Categories
Microsoft 365 Office 365 SharePoint

Integrating WordPress blog into SharePoint 2013

In this blog article, I will discuss about how we can easily integrate a WordPress blog with your SharePoint site with the help of SharePoint 2013 designer Work Flow.

Introduction

Using SharePoint 2013 REST API and building SPD based simple Workflow, we will fetch most recent 2 or more post from the blog site and add those in a SharePoint list.

If you are more interested about the advantages and disadvantages of the REST API, and for a comparison with other API’s, please refer the MSDN site here.

REST API Reference

Firstly, we will try to get the REST API provided by WordPress. Let’s go to WordPress developer’s resources site.

Here, you can get the list of REST API, from which you can choose as per your requirement.

In order to retrieve most recent 2 blogs we will be specifying the number=2 in the parameter such as below:

https://public-api.wordpress.com/rest/v1/sites/yourwordpressblog.com/posts/?number=2

Building SP2013 SPD Workflow

Open the SharePoint Designer and click on site work flow.

1

As you can see in the image, we will build a site workflow named “Get WordPress Recent Blogs”, which will read the information from WordPress Blog, create list items in a SharePoint list for further use.

Once the site workflow is created, you simply add stages, loops and name them properly, and then link them actions.

Name Stage 1 “Get Myblog Recent Items” and then add five actions and one Loop block, as shown in Figure 1.

2

Figure 1. Workflow Stage 1

  • Action 1 is not really required, but it will add one item to the history list, which can be used for debugging.
  • Action 2 is added to Call HTTP Web Service action. The HTTP URL is set to https://public-api.wordpress.com/rest/v1/sites/yourwordpressblog.com/posts/?number=2 and the HTTP method is set to “GET”.
  • Action 3 is again logging to history, the response should be “OK”. This means the WF is calling API perfectly.
  • Now we are creating a variable “itemcount “as Integer and setting the value to 2, since we require only 2 blogs.
  • Last action is to create another variable “Index” and set the value to 0.
3

In the “Call HTTP Web Service” action statement we do not set RequestContent or RequestHeaders parameter because we do not need to. We are only interested in the output of that web service. By simply setting the response parameter to a variable ResponseContent, the output of this web service call will get stored in the variable ResponseContent, which is a dictionary type variable.

The output of the web service looks like the following:

{“found”:5,”posts”:[{“ID”:124,”author”:{“ID”:7899331,”email”:false,”name”

……………..

To handle each blog item we could use the “responsecontent” variable so that we can put our action statement like “Get ([%Variable: Index%])/Title from Variable: responsecontent” to get Post’s property.

From the web service output we can see the ID, title. These are within “posts{“.

Just to make things simple and to show a clear structure of post inside web service output, the full path to access post’s properties, the statement like “Get posts[%Variable: Index%])/ID from Variable: ResponseContent“ will retrieve ID property of an item.

5

These are the workflow variable details:

6

Figure 2 shows all the different action items.

  • Firstly, pick the ID
  • Next, delete the same ID if the item exits in the SP list
  • Next four action is updating the variables with posts’ value
  • Last item in the loop is to add an item in the SharePoint List

Now increase the counter by 1 and the same actions are for the 2nd Item.

This is it! You are now you are ready to publish and start this workflow.

If you want to run the workflow daily, then add another action item after the loop end such as below:

7

Now your SharePoint List will have the blog content . That’s it 🙂

8

Conclusion

Lastly, adding a delay for 24 hours every day will enable the list to update with 2 recent blogs. This is a very simple yet very powerful example of REST API and SPD workflow.

Niraj Tenany

About Niraj Tenany

Niraj is Chief Executive Officer and a Co-founder of Netwoven, responsible for the strategic vision and direction. Niraj has been working with Fortune 500 companies to implement large-scale enterprise systems for the past 25 years.

Prior to founding Netwoven, Niraj led a profitable Enterprise Applications Consulting Practice at Microsoft. His team implemented large scale deployments of enterprise applications like Siebel, Ariba, and SAP with Fortune 500 customers. Niraj’s team also led the design and implementation of OLAP solutions based on the Microsoft platform. Prior to joining Microsoft, Niraj led a profitable Business Intelligence Consulting practice with Oracle Consulting Services.

Niraj has also worked with startup organizations in senior management positions. Niraj was the Director of Consulting Services at Zaplet, a Kleiner Perkins funded company.

Niraj holds a BS in Computer Science from Birla Institute of Technology, India, an MS in Computer Science from State University of New York (SUNY), and an MBA from Duke University’s Fuqua School of Business in North Carolina.

LinkedinTwitterFacebook

6 replies on “Integrating WordPress blog into SharePoint 2013”

I am working on sharepoint right now.. after installing wordpress everybody is complaining that the site gets very slow.

i reallly dont underst the possible conflict issue.

SharePoint Server 2013 brings a major advancement to workflow: enterprise features such as fully declarative authoring, REST and Service Bus messaging, elastic scalability, and managed service reliability.
“Call HTTP Web Service” – is a new workflow action of SharePoint 2013

Here I am using the Rest api provided by WordPress. If your blog hosted other than WordPress, check the rest api provided by the host. Other steps are same.

Leave a Reply

Your email address will not be published. Required fields are marked *