Featured post

Display SharePoint List Data In Jquery Data Table


Everybody knows that technology is changing rapidly. There are many things that we can integrate together. In this article, we are going to see, how to integrate the data table with SharePoint.

So, what is a data table?

As per Data Table’s official site definition:
“Data Table is a plug-in for the jQuery JavaScript library. It is a highly flexible tool, based upon the foundations of the progressive enhancement and will add the advanced interaction controls to any HTML table.”


We are starting our scenario.

Before starting with this post, we must have some basic knowledge of the following:

  • HTML Tables
  • Rest API in SharePoint
  • JavaScript Objects

First of all, create a SharePoint list, where we are going to retrieve our data and display it in our data table. For this, go to your SPO site and create a custom list. In my case, my list name is Employee, given below:


Now, add some columns to display in our list.


Some of the default columns are always there, when we add our custom columns to the list. Now, add some dummy data to our list, as shown below:


Note: Change the list view as per your requirement.

Now, we move to the functionality part, that suggests how we can get the data from SharePoint list. For this, we need two files; one is HTML file to render the data and another one is JS file to get the data from SharePoint list.

Go to Data Table CDN to get the required JS and CSS files.

We need to follow CDN scripts, that are required to be used in our functionality,

Now, create the HTML file in a text editor (In our case, we are using Sublime Text 3).

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>WiFi Home</title>
  5.     <script type=“text/javascript” src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js&#8221;></script> //External js file to get data from SharePoint List
  6.     <script type=“text/javascript” src=“/SiteAssets/GetData_Wifi.js”></script>
  7.     <link rel=“stylesheet” type=“text/css” href=https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css&#8221;>
  8.     <link rel=“stylesheet” type=“text/css” href=https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.jqueryui.min.css&#8221;>
  9.     <script type=“text/javascript” src=https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js&#8221;></script>
  10. </head>
  11. <body>
  12.     <table id=“table_id” class=“display” cellspacing=“0” width=“100%”>
  13.         <thead>
  14.             <tr>
  15.                 <th>Name</th>
  16.                 <th>Position</th>
  17.                 <th>Office</th>
  18.                 <th>Age</th>
  19.                 <th width=“18%”>Start date</th>
  20.                 <th>Salary</th>
  21.             </tr>
  22.         </thead>
  23.         <tfoot> </tfoot>
  24.     </table>
  25.     </div>
  26. </body>
  27. </html>

Now, we have to create JavaScript file (GetData_Wifi.js) to get the data from SharePoint list

For this, write a function to get the data, using REST API.

  1. function loadMyItems() {
  2.     var siteUrl = _spPageContextInfo.siteAbsoluteUrl;
  3.     var oDataUrl = siteUrl + “/_api/web/lists/getbytitle(‘Employee’)/items?$select=Name,Position,Office,Age,StartDate,Salary”;
  4.     $.ajax({
  5.         url: oDataUrl,
  6.         type: “GET”,
  7.         dataType: “json”,
  8.         headers: {
  9.             “accept”“application/json;odata=verbose”
  10.         },
  11.         success: mySuccHandler,
  12.         error: myErrHandler
  13.     });
  14. }

Now, the next thing is how to bind this data to our view (HTML) via data table?

For this, let’s put our success code in mySuccessHandler function (this is a part of asynchronous programming).

  1. function mySuccHandler(data) {
  2.     try {
  3.         var dataTableExample = $(‘#table_id’).DataTable();
  4.         if (dataTableExample != ‘undefined’) {
  5.             dataTableExample.destroy();
  6.         }
  7.         dataTableExample = $(‘#table_id’).DataTable({
  8.             scrollY: 300,
  9.             “aaData”: data.d.results,
  10.             “aoColumns”: [{
  11.                 “mData”“Name”
  12.             }, {
  13.                 “mData”“Position”
  14.             }, {
  15.                 “mData”“Office”
  16.             }, {
  17.                 “mData”“Age”
  18.             }, {
  19.                 “mData”“StartDate”,
  20.                 “render”: function(mData) {
  21.                     var date = new Date(mData);
  22.                     var month = date.getMonth() + 1;
  23.                     return (month.length > 1 ? month : “0” + month) + “/” + date.getDate() + “/” + date.getFullYear();
  24.                 }
  25.             }, {
  26.                 “mData”“Salary”,
  27.                 “render”: function(mData) {
  28.                     var sal = new Object(mData);
  29.                     var commaSep = mData.toString().split(“.”);
  30.                     commaSep[0] = commaSep[0].replace(/\B(?=(\d{3})+(?!\d))/g, “,”);
  31.                     sal.rup = “<span>₹</span>”;
  32.                     return ((sal.rup) + ” “ + commaSep.join(“.”));
  33.                 }
  34.             }]
  35.         });
  36.     } catch (e) {
  37.         alert(e.message);
  38.     }
  39. }
  40. function myErrHandler(data, errMessage) {
  41.     alert(“Error: “ + errMessage);
  42. }

Our final JS file will look, as follows:

  1. $(document).ready(function() {
  2.     loadMyItems();
  3. });
  4. function loadMyItems() {
  5.     var siteUrl = _spPageContextInfo.siteAbsoluteUrl;
  6.     var oDataUrl = siteUrl + “/_api/web/lists/getbytitle(‘Employee’)/items?$select=Name,Position,Office,Age,StartDate,Salary”;
  7.     $.ajax({
  8.         url: oDataUrl,
  9.         type: “GET”,
  10.         dataType: “json”,
  11.         headers: {
  12.             “accept”“application/json;odata=verbose”
  13.         },
  14.         success: mySuccHandler,
  15.         error: myErrHandler
  16.     });
  17. }
  18. function mySuccHandler(data) {
  19.     try {
  20.         var dataTableExample = $(‘#table_id’).DataTable();
  21.         if (dataTableExample != ‘undefined’) {
  22.             dataTableExample.destroy();
  23.         }
  24.         dataTableExample = $(‘#table_id’).DataTable({
  25.             scrollY: 300,
  26.             “aaData”: data.d.results,
  27.             “aoColumns”: [{
  28.                 “mData”“Name”
  29.             }, {
  30.                 “mData”“Position”
  31.             }, {
  32.                 “mData”“Office”
  33.             }, {
  34.                 “mData”“Age”
  35.             }, {
  36.                 “mData”“StartDate”,
  37.                 “render”: function(mData) {
  38.                     var date = new Date(mData);
  39.                     var month = date.getMonth() + 1;
  40.                     return (month.length > 1 ? month : “0” + month) + “/” + date.getDate() + “/” + date.getFullYear();
  41.                 }
  42.             }, {
  43.                 “mData”“Salary”,
  44.                 “render”: function(mData) {
  45.                     var sal = new Object(mData);
  46.                     var commaSep = mData.toString().split(“.”);
  47.                     commaSep[0] = commaSep[0].replace(/\B(?=(\d{3})+(?!\d))/g, “,”);
  48.                     sal.rup = “<span>₹</span>”;
  49.                     return ((sal.rup) + ” “ + commaSep.join(“.”));
  50.                 }
  51.             }]
  52.         });
  53.     } catch (e) {
  54.         alert(e.message);
  55.     }
  56. }
  57. function myErrHandler(data, errCode, errMessage) {
  58.     alert(“Error: “ + errMessage);
  59. }

Now, move to SharePoint part. First, upload the above JavaScript and HTML file to Site Assets library of SharePoint or whatever library you want.

Create a Webpart Page (Named DataTable) and store it in the pages or the site pages library.

Add a content editor to DataTable Page. Now, give HTML file reference to the content editor into Content Editor.

Content Editor

Click OK and save the page.

Now, our final output is shown below:


It’s Cool!
Now, play with the UI, provided by the data table plugin.

Conclusion: Thus, in this way, we see how we can work with DataTables and SharePoint together.

Did I miss anything that you may think is required? Maybe this is useful for someone. I hope you like it. Please share your valuable suggestions and feedback.


Create Interactive Custom Google Map In SharePoint Online


Maps have become a vital part of our life. In our day to day life, everyone is using maps for different purposes. So, here we are going to learn how to create a Google Map using custom list in SharePoint Online. For this purpose, we are going to use an Office app,  downloaded from Office Store.

So, we follow the below scenario to create the Map. First of all, log into your SharePoint Online tenant, using your credentials.


After logging into your tenant, create a custom list to store the location related Information, like Location name, Latitude, Longitude etc.


Create list columns and store data into list.

Note – Our column names depend on the Apptex documentation to create Google Map using Apptex.


Now, go to the SharePoint Store to install the Apptex app from there.

Click on New –> App.


In the left side navigation, click on SharePoint Store that redirects you to the SharePoint Store where you can download different free and paid apps from the market. Search for Apptex in search navigation and you will find an app named Apptex Designer.


As we have already installed this app into our SharePoint tenant, we are not able to add it again but it is very simple to add the Apptex Designer into your SharePoint environment.

After some time, the Apptex icon gets shown under your site content, as shown below.


Apptex creates a default library named Apptexfiles to store the JavaScript and CSS files, required to create a Google Map.

Now, create a new web part page (CSharp Corner Chapters) and add your previously created C# Corner Chapters list as a list view webpart. It looks like below.


Now, the actual journey to create the Map starts here.

Open Apptex app that is installed in your SharePoint site.

Image- Landing page of Apptex Designer app.

– Apptex provides a complete documentation on how to use Apptex Designer.

Click on Maps in the left pane. It expands like an accordion. Click on Custom Google Map.


In Custom Google Map overview tab, it shows all the requirements for us to create the Map. One important point is that you should only have the appropriate column from your list (View), set at your page where you are going to show your Map.


Now, click on “Apply” tab at the top, which opens a window to apply different settings. Here, it is important that you fill all the details carefully.

Target Page- The page on which you added your list to create a Map.

Target List View- Select the list in which you are going to apply the JS file to create Google Map.

Note – Actually, Apptex creates a JavaScript file for us that is used to apply onto the list and it creates a map for us.

Fields Mapping- Map the fields according to their title.
After selecting all the fields, click on “Apply” button at the end.


It creates a JS file for us. Copy the JS file address and paste it to the JS Link property of C# Corner Chapters list that we added on the “CSharp Corner Chapters” page.


Open “Charp Corner Chapters” page and edit it. While editing the Webpart properties of C# Corner Chapters list, you will find a JS Link Property under Miscellaneous option. Paste the copied JS file path in JS Link. Click “Apply” and then, OK.


Stop editing the page. Oops!!!!!!!!

What happened to your page? It is showing some error and not displaying well.


Do not worry at all. Press F12 to open the Developer tool and see what happened to your page. The Console shows an error stating it is the problem of Google Map Key.


Click on the error and it redirects to developers.google.com.


Click on API keys and client IDs.


Generate a key to use.

Image Google Map API Key

Copy the key and apply it to your JS file that you applied to JS Link property of C# Corner Chapters listView Webpart.

Find the path from JS Link for the JS file.


Go to the Site Contents and open Apptexfiles libray where our JavaScript file is stored. Download that file to your local drive and open in an editor like notepad++.


Apply the Google Map Key which we generated earlier to the downloaded JavaScript file at “maps.googleapis.com js source”.

Image- JS file to update Google Map key 

Save the file and upload it to replace the existing file in the library from where we have downloaded it.


Now, everything is done.

Go back to your page and hit “Refresh”. Your page looks like the below image. Zoom in and Zoom Out to see all the locations onto the Map.

Sometimes, it takes time to reflect the Map on our page but don’t worry, it will definitely work. If it is not working, do two things. Hit ctrl+F5 or replace the new key in the JS file that we modified.

Image-Custom Google Map


So, this is how we can create a Google Map with the help of third party app Apptex. Hope, you enjoyed the article, and are ready to give your valuable feedback.

Task Management In SharePoint (On-Prim/Online) – Part Four

You will definitely get something from each article on every website if you really want to learn.

Please have a look at our previous work on Task Management in SharePoint.

Where did we leave off in our last article?

In our last article (Part Three), we explored how we can work with Timeline in SharePoint Task list.
“If we want to learn something than it is the best choice to start from the beginning.”

Let’s start with a new phase in task list, that is Alert Me!

What are SharePoint Alerts

SharePoint alerts are email notifications that are sent by SharePoint when something changes in a library or list. By library we obviously mean a document library and by list – I mean any type of list in SharePoint. For example, Issues Log, Task List, Announcements, Contact List, some custom lists you created and Calendar (yes, the calendar is a list in SharePoint) can all have alerts setup and you can be notified of any changes made to them.(Source: SharePoint Alerts)

So here we go….

The first question that comes to our mind before assigning a task to a user is how a user comes to know that he/she has a task to fulfil or how a user is notified that you have some task to complete within some time limit.

In Task the list alert can be applied to list level or item level.

It is best practice to setup alerts on List level if want to get a notification on each and every item in the list and if we care about only a specific item then we have to setup alerst for that item only.

List level:

To setup an alert on the list first we go to list tab in the ribbon. There is a button named Alert Me,

Alert Me
Alert Me

When we click on Set alert on this list option, a popup opens like below image.


So here we have to fill some field to setup our alert on list level.

Let’s See:

Alert Title:

This is the name field for our alert i.e. what would be the name of our alert? This should be useful to identify what our alert does in some conditions (like an item added/changed etc.).

Send Alert To: This is used for to whom we want to send a notification (email). Here we can enter the username or email address to whom we want to notify about changes in our list. We can insert more than one users at a time.


Delivery Method:

In SharePoint there are two methods to send a notification to its user. One is through email and other is Text Messages (Mobile).


Change Type: Specify the type of changes that you want to be alerted to, i.e. which type of change is this?


Send Alerts for These Changes:

This is basically used for changing item state. Specify whether to filter alerts based on specific criteria. We can also restrict our alerts to only include items that show in a particular view.


When to Send Alerts:

Specify how frequently we want to be alerted. (Mobile alert is only available for immediate send).


So here we are going to setup an alert when we add a new item to our list.


Just fill the popup field as per our requirement. In our case, we want to setup an alert when awe adds an item in our list.


Now we have to test that is our alert working fine or not?

Add a new task to our Task list.


Now go to our Office365 outlook to check if we got a notification or not.


When we sign-in in our O365 outlook and check our inbox we get an email.

Yeah! We get the email of our Item creation in our list.

Here it is:


The subject of email shows that this is the mail for Added and one more interesting thing that happened with this email is that we have our task name as a part of our mail subject. We have all the information related to our task.

It’s amazing!!!!!!!

In this way, we can setup more than one alert for a single Task list and we can also manage all our alerts as per our requirement.


One more thing we forgot is  that when we create an alert for our list we also get a notification on our email that we have created an alert for our list.


Manage our alert:

To manage our alert we just simply click on Alert Me button in the ribbon and we find an option to manage our alerts.


Here is the main screen to manage our alerts!


So in this way, we can setup alerts for our list.

Now we are going to see  how to configure an alert for a single item in our list.
For this select an item in our list like below image and click on Alert me. This time, we get et alert on this item value instead of list.


All the processes are the same, as we create an alert for list aspect of  the Title of the alert. This time, we are not going to change the Title of alert.


We have to setup item alert as per our need/requirement and then click Ok.

Now, we have to do some changes in our task to test our Alert setup. So we add a new user in Assigned to thecolumn and save it.


Now if we check our Inbox we get an email something like this.


Wow! It is awesome……It is showing the changes too.

So here we learned one thing, that we can setup more than one alert for each level (list/item) and we can modify/delete these alerts as well.

Sharing of Task(s):

“In SharePoint Sharing of items is very broad.”

In SharePoint, we can share Task list and each and every element at a separate level.

To Share a Task list to someone else first we go to list tab in ribbon and click on Shared with button.


Now if we check the inbox of Puneet Gulati we come to know that he has got a notification regarding our shared item.


We can also share a single item from our task list; to do so we have to select an item in our Task List and then Tasks tab in ribbon where we get an option of Shared With


Now it is up to us how we are going to treat our task.


In this article, we see that we can do a lot of things with our task list in SharePoint. We see that how we can setup notifications (alerts) and sharing with our task list. We can also do a lot more things with SharePoint but it needs some patiences.

Hope you are enjoying SharePoint.

Task Management In SharePoint (OnPrim/Online) – Part Three

In this third article of series Task Management in SharePoint, we are going to learn some more interesting facts about task list in SharePoint.

Before going further please have a look at the previous parts of this series.

Note: This is the third part of series Task Management in SPO.

Let’s first update the details in our Task List as we leave it before some time.


As we change the status of our tasks in Task List it looks like above image i.e. percent complete get affected and we changed the Priority as well.

Let’s see what we can do next to our Task Management.

In our last article, we skipped a point in Tasks Tab; that is Add to Timeline. Task list in SP (SharePoint) comes with a Timeline by default. This is a very interesting feature of a task list that we can show our task(s) in some cool graphical format (Timeline). Let’s have a look.


To add our task in timeline we have two options,

  1. Check the task in the task list and go to Tasks Tab then click on Add to Timeline button.


  2. Click on three dots (…) in the task list and a popup opens. Here’s the screenshot,


    When we click on ADD TO TIMELINE, it automatically adds to the Timeline gave for the Task List. Here we are going to add 3 task(s) in our timeline.

    We can also remove the tasks from a task list vice versa. When we click onto a task in the timeline it automatically enables a tab in the ribbon.


    Next, we are going to see what interesting things we can do with timeline.

We can do the following things with timeline.

  • Can Change font family for tasks text in the timeline.
  • Can change the size of the text.
  • We can make our text BOLDitalic, and underline.
  • We can change the background color for the task(s) in the timeline as well as we can change font colors too.
  • Can include Task Dates, Today line, Start and finish option to timeline Timescale for tasks.
  • We can change the date formats for tasks.
  • We can change the display style of our task(s) in the timeline. Can lock the width of Timeline.
  • Last but not least we can remove any task(s) from the timeline.

Have a look at the following image,


If you don’t like to see the timeline for our task list, then remove this from its default view.

To achieve this we have to follow some steps.

  • Click on LIST tab in ribbon and then click on Modify View,


  • When we click on Modify View we see a new window opened. Find Style option and expand it, uncheck the Show timeline above the view and that’s it.,

    In this way, we see that how to work with the timeline in the task list. In our next article, we are going to see that how to work with Alert in Task List.

Hope you are enjoying the series.


In this article we learned some basic understating of how to work with the timeline in SPO task list. This is a graphical representation of our task so that we can manage it accordingly.

Thanks for reading.

Task Management in SharePoint (On-Prim/Online)-Part Two

In this article, we are going to learn some new concepts on our Task list in SharePoint.

In our previous article on Task Management in SharePoint Part One ,we learn some basic stuff that we can perform on our task list.

The previous article overviews at a glance-

  • What is Task List in SharePoint?
  • How to create a Task List in SharePoint?
  • Insert some task (item) Task List in SharePoint.

In this second article of Task Management, we are going to do some very cool stuff.

So, here we start…

Let’s first add some more tasks to our Task List like below-


Now the first question come into our mind that what is the benefit of this information stored in this list and how we can be beneficial by this.

The answer is as below-

Manage Tasks in Task list-

Before going further first change the view of task list as per our need. There are several predefined views for Task List like Calendar, Completed, Gantt chart, Late Tasks, etc.


So here we are creating our own view .Click on Modify this View and select the columns that we want to show by default for our list.


So now our task list look like this


This is slightly different from our previous view.

Don’t worry we are on right path. This will be more exciting in just a minute.

First, we understand each and every column of this view. We start from beginning to end.

Column 1: Completed


If we hover over on the first column first row it shows the above information means if we click the checkbox that means this task has been completed. See below Images for more clear understanding

Before –




Instantly when we click on check box it marked as completed and this entry moves at bottom position in the list.

Column 2 & 3: Start Date and Due Date

These columns show the starting date of the task (i.e. when a task is assigned) and due date we can say that this is the end date when we have to complete the task to the deadline date respectively.

Column 4: Assigned To

As the name suggest, this is used to assign a task to a user or a group of users.

Column 5, 6 & 7:

% Complete: This field is used to show the percentage of completion of the task. This is a manual field means we have to enter values manually.


Priority: This column contains the importance of the task. By default, it contains 3 values.


Task Status:

It contains the status of task or we can say that at which stage is task right now.


Note: If we have a good understanding of Site Columns and Content Types we can do a lot with SharePoint lists. For example, if we want to add some predefined values to our list then we can create our own content type.

Now have a look at item level activities.

Just click on an item in the list as figured below and look into the ribbon for different action


The buttons in the ribbon are shown under the Tasks tab.Some of the actions we know already if we have some basic understanding in SharePoint(like New Item,View Item,Edit Item,Shared With, Delete Item).


Let’s discuss other buttons in tab

Insert: If we click an item in the list then Tasks tab is enabled and when we click the Insert button it insert an item in the list just before the current selection.

Note: Don’t confuse with the item word, it is used for a task in the Task List.


Outdent and Indent: In simple words we can say that these two buttons are used to work with the main task and subtask. Let’s take our list example.

Every task in our list is treated as the main task or the separate task. When we click on Task 2 and then we click on Indent button it becomes the subtask of Task 1


And when we click on Outdent it reverts the subtask to the main task.

Move Up and Move Down: These two buttons are used to move the task upward to downward and vice versa in the list. Just notice the positions of tasks in the list.


Outline: It is basically used to hide and show the subtask of the main task.


Add to TimeLine: This feature is used to show a task in the timeline (discuss in more details in upcoming article).

Attach File:Used to attach a task specific document to any task in the list.

Alert Me: This is basically used for mailing purpose or we can say that this is used to send an alert to specific user(s) at some action performed at the task(s).We will discuss its use in next article.

Workflows: Used for workflow purpose.

Summary: In this article we learn something new about the task(s) in our task list. Task list make it easier to manage our Project related activities or task specific activities in our organization. In this way, we can arrange our task as per our need.

Please have a look at our Part One article of this series.

Alert! Your suggestions and questions are always welcome.

Thanks for reading this!

Hope you like it.

Task Management In SharePoint(On-Prim/Online) – Part One


This is a big challenge for the organizations who are working on a project to manage the information related to a project/task. For this, they create their own tool or they manage project-related information in the form of paper documentation.

So,here we go.

What is a Task List in SharePoint?

As the name explains, that it is something related to Task. In SharePoint, we have lots of things out of the box. Task list is a list in SharePoint that is basically used to manage the people specific tasks or team specific tasks in an organization.

In simple words, we can say that this is a list that store task related information.

How to create a Task list in SharePoint?

Remember that for this scenario we are using SharePoint Online (Trail in our case).
To create a task list in SharePoint first we login to our SharePoint Online site.


After logging in into our SharePoint online site, we see a home page such as this.

home page

This is the default look and feel of our SharePoint Online Team Site.

We can add a Task list on our site by two ways,

  1. By clicking on Working on a deadline?(an image) at the homepage.(We explore it in our next article)
  2. By using Site Contents option of SharePoint.

In this article, we are going to use the second option.

So, click on setting icon on the top left. After clicking on setting icon there is an option called Site contents. Click on Site contents.

Click on Site contents

After clicking on Site contents, we have to look at how we create a task list,

Click on add an app,

add an app

After clicking on the above icon we redirect to a page. There are many options to add a different type of list and libraries, but we need task list.

So click on Tasks icon (This is not just an icon but it is a way to create a task list in our SharePoint environment).

create a task list

Just enter your list name in the text area and click create. If we want to see some advanced options related to task list then click on Advanced Options.

So here is our Task List,

Site content

Now it’s time to put some information on our list. Open your Task List by clicking on the list icon.

This is the default view of our list when we first open our list.

Task list

Now click on new task to enter some information in our list so that after we can perform some useful action on our task.

Enter some task related information into fields


This is the default edit window of our task list. In our upcoming articles on Task Management Series, we explore it more.

Fill the details as below-

  • Enter the name of the task.
  • Enter start date
  • Enter due date.
  • Type the person name to whom you want to assign a task.

Click on save.

Now this is our final data in Task List

new task

To add more tasks in our list follow the same process as above.


In this article we went through some basics of Task List in SharePoint and how we can create a task list in SharePoint. In our next article, we are going to see how we can take benefits from Task List and many more good thing that we can do with our Tasks.