0 Shares 816 Views 1 Comments

Using MS SharePoint as data source : Part 2

Aug 09, 2016
816 Views 1
Using Sharepoint

In the last post [ Using MS SharePoint as data source : Part 1 ], we went through the understanding of SharePoint in brief. Now that you have all the information, let’s proceed on the scripting part and see how easily we can retrieve and post data to SharePoint.


This a three part series on using sharepoint as data source

Part 1 – Sharepoint and usage Basics
Part 2 – Retrieve data from Sharepoint
Part 3 – Post data to Sharepoint


We are going to use XMLHTTP object to send the request and XML DOM Document to load and parse the response. Let’s consider a SharePoint list Named as “Employee”, which contains Employee data as below. And we need to filter data based on the Grade. 


Sharepoint List


Create Request

The very first thing we need to do is, to create the request with query.

Start with the fixed header

Body Part – use the method GetListItems, which provides all the records in the SharePoint list, provide the list name which you need to connect.

In this case we need to mention “Employee”


Query Part – In order to get the required row(s) based on some condition, we need to mention the condition in the query part of the request. We explained the CAML query in the last post. In this example we would use to filter the record by Grade, let’s say all the employees with Grade as “VP”

The complete Request should like below



 Let’s proceed on to the scripting part now. As mentioned earlier we will use XMLHTTP to post the request to the service. XML DOM (Document Object Model) components include the XMLHTTP object, which provides client-side access to XML documents on remote servers through the HTTP protocol. It exposes a simple API which allows you to send requests and get the response.



Here url should be your SharePoint site service url


 and the request is the one we created above

Once you post the request, you need to get the response out. If you need for reference you can save the response as well. To load the response xml and parse we will use DOM Document

Here, You will get all your data from SharePoint in the object – colItem . Further you can loop through all the items and use as required.  In this case let’s say we need return the ‘first name’ in an array

Below is a generic function for your reference

To use this function


I hope you will find this post useful, in the next post we will see the easiest way of posting date or updating data to the sharepoint.


You may be interested

UFT Patch Updates – UFT 14.03
Unified Functional Testing
154 views1
Unified Functional Testing
154 views1

UFT Patch Updates – UFT 14.03

Saket - Mar 11, 2018

Post the launch of UFT 14.0, there are three patch updates has been released including a number of features and enhancement. Recently Micro Focus unveiled third patch…

Setting up Web Service Automation Project
Katalon Studio
Katalon Studio

Setting up Web Service Automation Project

Saket - Oct 24, 2017

Web services are specific services that can be published and called over the Internet by client applications. Katalon Studio supports functional testing of web services. This topic…

Setting up Mobile Automation Project in MacOS
Katalon Studio
710 views1
Katalon Studio
710 views1

Setting up Mobile Automation Project in MacOS

Saket - Oct 09, 2017

Using Katalon Studio, mobile tester can design automation test for both Android and iOS to run on physical devices, cloud services and emulators. This tutorial explains how…

One Comment

  1. Pingback: Using MS SharePoint as data source : Part 1 - Automated-360

Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Email Address
Secure and Spam free...