Get recurring event from calendar list using Angular JS

Getting recurring event from calendar list using Angular JS is some bit tricky.
I am going to implement through CEWP(Content editor web part) in SharePoint.

1. Create HTML file for display events description(Angular View)

<html ng-app="myApp">
	<head lang="en">
		<script src="jquery.min.js"></script> 
		<script src="angular.min.js"></script>
		<script type="text/javascript" src="main.js"></script> 
        <div ng-app="myApp" ng-controller="myCtrl">
            <div ng-repeat="result in results">   

Give the reference of Jquery and Angular js from your SharePoint site.

If you want to display upcoming limited(suppose top 5) events then you can add condition which is inbuilt facility of Angular JS

Add condition(ng-if) in Angular repeat section

<div ng-repeat="result in results" ng-if="$index < 4">   

2. Now Create one JavaScript which will get all events from calendar event list and check event start date with current date and display only feature events only.

var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope, $http) 
    $scope.results = [];
	var currSiteUrl = _spPageContextInfo.siteAbsoluteUrl;
	var webUrl, calendarListName;
	webUrl= currSiteUrl;
	wsURL = webUrl + "/_vti_bin/Lists.asmx";	 
    $scope.request =
        "<soap:Envelope xmlns:xsi='' xmlns:xsd='' xmlns:soap=''> <soap:Body>" +
        "<GetListItems xmlns=''>" +
        "<listName>" + calendarListName+ "</listName>" +
        "<query>" +
        "<Query>" +
        "<Where>" +
           "<DateRangesOverlap>" +
           "<FieldRef Name='EventDate' />" +
           "<FieldRef Name='EndDate' />" +
           "<FieldRef Name='RecurrenceID' />" +
           "<Value Type='DateTime'><Year/></Value>" +
           "</DateRangesOverlap>" +
        "</Where>" +
        "</Query>" +
        "</query>" +
        "<queryOptions>" +
        "<QueryOptions>" +
            "<ExpandRecurrence>TRUE</ExpandRecurrence>" +
        "</QueryOptions>" +
        "</queryOptions>" +
        "</GetListItems>" +
	var results1 = [];
        method: 'POST', 
        url: wsURL, 
        async: false,
        data: $scope.request, 
        headers: {
            'Content-Type': 'text/xml; charset=\"utf-8\; action=""'
    .success(function(xData, status, headers, config){       
        if (status === 200)
             var root = $(xData);
                    root.find("listitems").children().children().each(function () {
						$this = $(this);
						var ids = $this.attr("ows_UniqueId").split(";");
						var rec = $this.attr("ows_fRecurrence");
							"StartTime": $this.attr("ows_EventDate"),
							"EndTime": $this.attr("ows_EndDate"),
							"Title": $this.attr("ows_Title"),
							"Recurrence": (rec === "1" ? true : false),
							"Description": $this.attr("ows_Description"),
							"Guid": ids[1],
							"Id": ids[0],
	    var filtered_item = [];
	    for (var i = 0; i < results1.length; i++) 
			var current_Time = new Date().getTime()
			var Start_Time = new Date(results1[i].StartTime).getTime();
			if (Start_Time  >= current_Time) {
      $scope.results =  filtered_item;
    .error(function(data, status, headers, config){
        console.log('In Error');

To get the recurrence event we have added parameter “ExpandRecurrence” with value “True” by which we can identify that event is recurrence or not.

In output you will get Title, Description, Start time and location of event. You can customize as per your requirement and apply css also.


Upload Document using c# code to Share-Point library

Hello everyone,

I was facing the following exception.So i had searched and got the solution.

Only String, int, and DateTime data types can be used as the value in Properties while adding list item in document library.

I am including following concept with this blog.

1) how to upload document in to SharePoint library from the other library.
2) pass the document metadata using hash table.
3) How to update custom field of SharePoint library with uploaded document.
4) Limitations of Files.Add() methods with hash table.

Key Concept :
What is hash Table?

  • The Hashtable class represents a collection of key-and-value pairs that are
  • organized based on the hash code of the key.
  • It uses the key to access the elements in the collection.
  • A hash table is used when you need to access elements by using key, and you can identify a useful key value.
  • Each item in the hash table has a key/value pair.
  • The key is used to access the items in the collection.

1)How can I upload document in to the Document library from the other document library and update Document library meta data in share point?
2)How can I update document library custom field with user type and Date time type Using c# code?
Let’s take document library:
1) UserInformation(Destination Library)
Custom Fields : 1) DocUpdateDate: DateTime 2)DocAddedBy: User
2) BioData(Source library)


//Get the Source library
 SPList BioData = elevatedWeb.Lists.Cast().FirstOrDefault(l => == listID);
 if (bioData!=null)
 spListItem bioDataItem = bioData.GetItemById(itemID);
 // get file from the item which you want to upload the destination.
 SpFile objFile = Item.File;
 string fileName = objFile.Name;
 //Getting latest published version file content
 byte[] fileContent = null;
 if (objFile.UIVersionLabel.Contains(".0"))
 fileContent = file.OpenBinary();
 string versionString = string.Format("{0}.0", objFile.MajorVersion.ToString());
 SPFileVersion version = objFile.Versions.GetVersionFromLabel(versionString);
 fileContent = version.OpenBinary();
 // Now open the Destination library where you want to upload document.
 SpList UserInformation = elevatedWeb.Lists.Cast().FirstOrDefault(l => l.ID == listID);
 // create a hastable to stored the Document metadata.
 HashTable properties = new HashTable();
 // Add metadata key and value of the document.
 // you can number of properties as per the business requirement.
 // now upload the document in to the library.
 // to upload the file ,open the object of the SpFile.
 elevatedWeb.AllowUnsafeUpdates = true;
 SpFile uploadFile = UserInformation.RootFolder.Files.Add(fileName, fileContent, properties);



Limitations of Files.Add() methods with hash table.
If I add a column of type Currency then the code will break and it won’t add the list item to the library at all.Because the function list.RootFolder.Files.Add() will not accept the properties other than the 3 types mentioned,through HashTable
This is the problem with the function. To avoid that below is the code i used and this problem went away.


// create a SPListItem object from the objFile.
spListItem objListItem = uploadFile.Item;
objListItem[“DocUpdateDate”] = DateTime.Now;
// update list item
elevatedWeb.AllowUnsafeUpdates = false;


Finally, updating the list item and updating the file to reflect the changes to the document library list items.

Please feel free to post your ideas, comments and question here.

Happy Coding 🙂

How to Get web/site/List/ Tittle in CQWP.


Explain you here How to Get web/site/List/ Title in CQWP.

Once I got this requirement How to get Web Title or web title where Item is coming and Bind in CQWP

I have done lot`s of R&D For that but there no provision to get web Title or List Title Direct From ItemStyle.xml

It is Possible but How Let `s See

  • Open your .webpart File
  • Find “ViewFieldsOverride” Property
  • In this Property we have to override SharePoint default column like (created, Modified)+your view Column that you use to display in CQWP
  • But Best Practice is just Taking all Field and put it in to this in My Case I have use Task List
  • Now if you want to get Web Title then Define “<ProjectProperty Name=”Title” />”  ,This will return you web/Site Title
  • Same as if you want to get List Title <ListProperty Name=”Title” /> in same manner you can notice in below code
  • Remarks Must Define your FieldRef and Properties inside  <![CDATA[ ]]>  ok now save and upload your web part

<property name=”ViewFieldsOverride” type=”string”><![CDATA[
<FieldRef ID=”{fa564e0f-0c70-4ab9-b863-0177e6ddd247}” Nullable=”True” Type=”Text” />
<FieldRef ID=”{64cd368d-2f95-4bfc-a1f9-8d4324ecb007}” Nullable=”True” Type=”DateTime” />
<FieldRef ID=”{cd21b4c2-6841-4f9e-a23a-738a65f99889}” Nullable=”True” Type=”DateTime” />
<FieldRef ID=”{53101f38-dd2e-458c-b245-0c236cc13d1a}” Nullable=”True” Type=”User” />
<FieldRef ID=”{d2311440-1ed6-46ea-b46d-daa643dc3886}” Nullable=”True” Type=”Number” />
<FieldRef ID=”{7662cd2c-f069-4dba-9e35-082cf976e170}” Nullable=”True” Type=”Note” />
<FieldRef ID=”{c3a92d97-2b77-4a25-9698-3ab54874bc6f}” Nullable=”True” Type=”Lookup” />
<FieldRef ID=”{a8eb573e-9e11-481a-a8c9-1104a54b2fbd}” Nullable=”True” Type=”Choice” />
<FieldRef ID=”{c15b34c3-ce7d-490a-b133-3f4de8801b76}” Nullable=”True” Type=”Choice” />
<FieldRef ID=”{8c06beca-0777-48f7-91c7-6da68bc07b69}” Nullable=”True” Type=”DateTime” />
<FieldRef ID=”{1df5e554-ec7e-46a6-901d-d85a3881cb18}” Nullable=”True” Type=”User” />
<FieldRef ID=”{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}” Nullable=”True” Type=”DateTime” />
<FieldRef ID=”{d31655d1-1d5b-4511-95a1-7a09e9b75bf2}” Nullable=”True” Type=”User” />
<FieldRef Name=”PublishingRollupImage” Nullable=”True” Type=”Image” />
<FieldRef Name=”_Level” Nullable=”True” Type=”Number” />
<FieldRef Name=”Comments” Nullable=”True” Type=”Note” />
<ListProperty Name=”Title” /><ProjectProperty Name=”Title” />

-Now open you ItemStyle.xml

you can access Project title  and List Title by

<xsl:value-of select=”ProjectProperty.Title”/>  //Get Web Title

<xsl:value-of select=”ListProperty.Title”/>   // Get List Tittle

Remark Once you modified your webpart ovverride List in  <ProjectProperty Name=”Title” />

in ItemStyle.xslt you will not Get absolute URL [&SiteUrl,$LinkUrl,$PageUrl]

you will get break url in these object so it is tuff to manipulate this URL and get Absolute URL

if you want to get URL For Item you can define <ProjectProperty Name=”Url” /> inside ViewFieldsOverride

now you can access url in Item Style <xsl:value-of select=”ProjectProperty.Url”/>

Hope you Get your issue Resolve from this

Thanks SPS

Copy Document and metadata From one library to Other library using Nintex

Hello Tech People,

I am explaining about Nintex Work Flow which is using in share point to fulfill most of the business requirement.

What is Nintex?

Requirement : 

How can i copy Document and metadata of Document library in share point to other Document library ?

In simple language i have Two Document libraries.

Requirement Of nintex WorkFlow

Requirement Of nintex WorkFlow

I hope you got Requirement carefully.

Solution : 

I m going with the assumption that , Every one has created Two Document library. 1) Source 2) Destination

Click on SourceList -> Click on library in Top Ribbon -> Click on Workflow Setting – >  Create nintex Workflow.


You have to install nintex if you don’t have . Other Wise “Create Workflow in nintex workflow” is not displayed.

And If your system has already nintex . after that you have to active some feature at site collection level which is regarding nintex.


now click on “Create WorkFlow in nintex workflow” nintex Workflow screen will be open .

— > Select Blank WorkFlow and give it Unique Name.After create you can see display which i have define below.


— > Search “Copy to Sharepoint” In Search box . Drag the symbol and put it on Workflow. and name it “Copy Metadata from one Document To Other.” (you can give as per your mood also.)


now click on ARWDOWN in Workflow and Set necessary configuration to fulfill the requirement.


  1. Select Destination :  You have to pass the URl of the Destination Document Library .
  2. over-Write option : 1) Remove existing item 2) Rename new item 3) Update Existing item
  3. Check Create folder Structure
  4. Check Copy In MetaData

Last Step Save the WorkFlow -> Publish it – > Add item to document library – >Check Destination Library 

Note : Nintex Workflow Develop only in IE. 

Have any query , feel free to ask me .

Happy Coding 🙂

Apply Slider in Content Query Web part(CQWP) using XSL

Hello everyone ,

I hope, You are well and doing good.

What is CQWP?

SharePoint Content Query Web Part (CQWP) is a powerful tool to display aggregated content from various SharePoint pages, lists and libraries .

Note : More Information regarding cqwp

Now i am here to explain you how to get List item from SharePoint list and library and display it in Content Query Web part  with attractive manner and  user friendliness.

Now, i have a question .How can i make it attractive manner ? Right . Let me Explain You. I want to tell you that , In attractive manner means put some animation,Give effect with sliding etc etc.

Business Requirement :

I have one share point list name with NewsList. Now i want to display data in “Newslist” on my home page with sliding effect. E.g   I have 5 records in NewsList and I have to display Top 3 records in CQWP . Only one record display in one slide.Slider has to be automatically working . Display field of NewslIst is “Title”, “Date” and “NewsContent” . If  “NewsContent” is more than 40 Characters , than Only 40 characters can be in slider and must be a link Read More… Below that.

I  Hope , Everyone is clear with Requirement. Now i am going to describe solution to fulfill this requirement. There is two way : 1)Add Script Editor to with content query web part and load necessary .js file to share point . 2) Add and load .js file using XSL . I  have prefer second way for get output Solution : Step :1

  •  You have to create one list or library in your share point site.
  • After that you have to select content Query Web part in your page where you want to implement slider

Note: If you are working on TeamSite than you have to activate two features to use CQWP .  1) SharePoint Server publishing infrastructure.(Site level) 2) SharePoint server publishing(Web level) But if you are using Publishing Site than no worry . Two features automatically activated by share point.

  •  Now, You have to configure such setting to get list records in CQWP.

Step : 1

CQWP Steps to open CQWP Tool Part : Edit Page –> Click on Edit Web part –> Tool part is open in left side of your page

Now you have to set path of resource from which you want to take data and show it in to CQWP. Either it is list or Library.

Step : 2

You have to  Export webpart.

Steps to export webpart.

Edit Page -> Edit Webpart ->Click on Export Button ->Web part exported successfully in your local macNow you h


Open Exported .webpart file in share-point designer or in other tool like note or notepad++.

Step : 3

You have to change value of two properties in .webpart. You have to change value of this properties if you are using your custom “itemstyle.xsl” or “contentquerymain.xsl” . if you are using default file than you have not to change it.

1)ItemXslLink   2)MainXslLink

Set your itemstyle.xsl file path in itemslLink and contentquerymain.xsl in Mainxsllink. You can see in image .


Close the.webpart fie and upload webpart in sharepoint.

Edit Page -> Insert -> Click on webpart ->Click on upload webpart -> select webpart -> Click on Upload 

Upload webpart

Step : 4

Now open Itemstyle.xsl To put your login for slider.

I had use Jassor.slider to display data with sliding . You can use any other slider to display data.

Here , Create your custom template to display data in ItemStyle.xsl. i have created SliderTemplate . Here CurPos and LastRaw is two parameter to give some css  or display data in some manner.

This Two parameter is define in contentmain.xsl.







Note :Why is it necessary to create and call “removemarkup”?

If you are direct get data from body field in announcement list than you can get string with some html tag and special character which is not understandable by non-technical person. So we have to remove this type of tag and special character

So i have to remove this type of tags using “removeMarkUp” template. you can use it as per your requirement.


Now  Open your site . open Wenpart Tool panal . and check your custom template is present or not.


If Template is displayed in drop down . That means you have successfully  configures custom template to the web part. You can see slider on page with necessary data.

Kindly contact me if have any query regarding this post.

Happy Coding 🙂

Create Site Column Programmatically in SharePoint


Today I am going to explain you How to create Site column Programmatically (xml)

It should be also created through OOTB and PowerShell

What is site column

Site column is pre define site column which are reused in various content type and List, Libraries

For e.g. you can create a site column “Sample” with a Single Line of text data type . This column then can be added to any content type in your list or library.

We can achieve it two ways

Using Declarative XML

code (Feature Activation Event Receiver)

In this blog we can achieve it through xml..

Ok let`s start

Continue reading

Modules to Include Files In Sharepoint (Basics)


I am going To Explain you Basic Concept of module in share point this is just basic Example How Module is Work actually in sharepoint

Not Confused with Visual Code Module ,Basic use of module Just place File in your Sharepoint Server at specific Locations by Deploying your Solutions

ok Let`s Start the stuff Just Follow Below steps

1.Open Visual Studio and Create New Empty Solution Name (Module Test)

2.Now Open Your Solution Explorer and Right Click on IT

3 Go To add New Item add Module(Name -Module1)

4 Now you can Notice module is Add in your Solution Which Contain two Default File(Element.xml,Sample.txt)

5.Open your Element.xml you can notice Default code Like Below

<Elements xmlns=””&gt;

<Module Name=”Module1″>

<File Path=”Module1\Sample.txt” Url=”Module1/Sample.txt” />



6. Do not change any thing just Deploy solutions and check you sharepoint site Sample.txt File on placed at Module/Sample.txt

File Element has Following Attributes

Attribute Name Description
Path The name and location of the file in the SharePoint solution. The format is,Path=”Module1\Sample.txt”.
Url The location where the file will be deployed on the SharePoint server. The format is,Url=”Module1/Sample.txt”.
Type An optional attribute that has two settings: GhostableInLibrary and Ghostable. The format is,Type=”GhostableInLibrary”. Specifying GhostableInLibrary means the file will be added to a document library in SharePoint together with a list item to accompany the file when it is added to the library. Specifying Ghostable causes the file to be added to SharePoint outside the document library

This is just basic example for your Understanding  I will write more example of Module.Soon




CRUD Operation with REST API in SharePoint

Overview of CRUD operation with REST API in SharePoint will be explained in this article.


SharePoint 2013 enables you to remotely interact with SharePoint sites by using REST. By using REST API you can interact with SharePoint site from any technology which can support REST API i.e. IPhone, Android, PHP, JAVA etc..


Now question is what is this REST API?

Full form of REST is Representational State Transfer (REST). This is service provide in SharePoint 2013. To perform all basic operation which can be perform using CSOM or JSOM.


So now you will ask that what is new in REST API?

REST API has obvious benefits for mobile applications that are written in non-Microsoft platforms, such as iOS and Android devices, and it’s also a useful resource for Windows 8 apps which are written in HTML5 and JavaScript which can interact with SharePoint site through REST API.

Now come to the point how to use REST API in SharePoint?

To use REST API you need to construct a RESTful HTTP request string using OData Standard (OData = Open Data Protocol)



Construction of REST API URL

Base URL

   http://<domain>/<site url>/_api/

Retrieve the lists from a SharePoint site

   http://<domain>/<site url>/_api/web/lists

Get a particular list by specifying its ID or Title


In REST API you need to pass address of your site then add “/_api/lists/” and all list in site will be display. You can use other REST Client to perform REST Queries.To access any Site Collection you need to pass “_api/site” and to access any site then you need to pass “_api/web


Get Groups in site by using REST API



Get user by user id



Remove particular user from group

  url: "<app web url>/_api/web/sitegroups(GroupId)/users/getbyid(UserId)",
  method: "POST",
  headers: { "X-HTTP-Method": "DELETE" },
  success: successEventHandler,
  error: errorEventHandler


Get all user in Site/Web



To get all groups of site


Get all items in List



Option for filtering and sorting data in REST API

Option Purpose
$select Specifies which fields are included in the returned data.
$filter Specifies which members of a collection, such as the items in a list, are returned.
$expand Specifies which projected fields from a joined list are returned.
$top Returns only the first n items of a collection or list.
$skip Skips the first n items of a collection or list and returns the rest.
$orderby Specifies the field that’s used to sort the data before it’s returned.



_api/web/lists/getByTitle('Languages')/items?$filter=LanguageScope eq 'High'


Note: Multiple option can be combine using “&” operator

_api/web/lists/getByTitle('Languages')/items?$select=Title&$filter=LanguageScope eq 'High'&$top=2



This will get top 2 item Title whose Scope=’High’


Best way to use REST Call is AJAX.

Here is simple example of REST Call with AJAX

  url: "http://<site url>/_api/web/Users",
  type: "GET",
  headers: { "content-type": "application/json;odata=verbose" },
  success: successEventHandler,
  error: errorEventHandler


Create New Web using REST API


Note: Here Type will be “POST” because we are putting data in SharePoint. Otherwise it will generate error.

  url: "http://<site url>/_api/web/webs/add",
  type: "POST",
  data: "{ 'parameters': { '__metadata': { 'type': 'SP.WebCreationInformation' },
    'Title': 'NewMyWeb', 'Url': 'MyCustomWeb', 'WebTemplate': 'STS',
    'UseSamePermissionsAsParentSite': true } }",
  headers: { 
    "X-RequestDigest": "Digest value",
    "accept": "application/json;odata=verbose",
    "content-type": "application/json;odata=verbose",
    "content-length": "Body Data Length"
  success: successEventHandler,
  error: errorEventHandler


Delete Web using REST API

To delete any web we need to specify url for that particular web and make sure


otherwise delete operation will not perform

  url: "http://<site url>/_api/web",
  type: "POST",
  headers: { 
    "X-RequestDigest": "Digest Value",
    "X-HTTP-Method": "DELETE"
  success: successEventHandler,
  error: errorEventHandler


Hope now you will get enough idea to get start with REST API in SharePoint.

Please Like and share this blog and comment if you are stuck anywhere.

Happy Coding..!!
Learn code while playing with it..!!

Bind ColorPicker Control to the sharepoint List field using JSlink

Hello Developers…

I am back to share something new things with you guys. and i am pleasure to sharing.

Today , First of all i m explaining you what is the business requirement .

Definition : I have created custom list(ColorList) in share point  . In this there are two column Title and Color. in the Color column type is Text . now i want to render Color column with color-picker control and save the color code to the share point list  with # . I have uploaded image below.


You can see what i want as an output.  right ?

Solution : 

first of all i have searched lots of colorpicker.js . At last i have download jquery.colorpicker.js and used it because this Js file give me almost all the functionality which is i required.

You can find of colorpicker.js from this link .

Once JS is decided upload JS file to share point _catalog folder with proper naming convention . Open Your url in share point designer and Click on “All Files” -> Click on “_catalog” -> Drag An Drop Your file to this folder. Folder is automatically uploaded to the your share point server.

You have to all necessary files upload in share point.

List of files you have to include in share point.

1) colorpicker.css



4)Images of Color picker and layout js in proper folder.

now, open your SharePoint Page on which you want to apply Js link . That must be One or more from the three pages.




i have write on NewForms.aspx to fulfill requirement.

Now open NewForms in Edit mode.


Right Click On Edit Web part -> select Miscellaneous -> Add Jslink to JSlink Tab -> Save ->Stop editing.

This is the process to bind jslink to NewForm.aspx.

Now i am explaining , What is JSlink in share point ?

-> Jslink  is simple java script to render your control with more user friendliness and attractive. you can use Jsquery,AngualrJS whatever you ant to implement.It’s a purely combination of CSS and JS File for client side rendering.

->You can apply lots of combination to the share point default pages .

What Jslink do excatly?

-> Jslink simply override your control with share-point control .

Now i m coming on code,


(function () {
// Intialize the variables for overrides objects
var overrideCtx = {};
overrideCtx.Templates = {};
//overrideCtx.OnPostRender = [];
//overrideCtx.OnPostRender.push(function(){OnPostRenderFunc(); });
// Override field data
overrideCtx.Templates.Fields = {
‘Color’:   //Color is our field name which will replace by the color picker control .
‘NewForm’: ingredientsNewAndEdit // ingredientsNewAndEdit function to render our HTMl to sharepoint Newforms,aspx
overrideCtx.OnPostRender = postRenderHandler;
// Register the override of the field
function ingredientsNewAndEdit(Ctx)
var string = “/_catalogs/masterpage/layout.css,/_catalogs/masterpage/colorpicker.css”
for(var i=0 ; i<string.split(“,”).length;i++)
var link = document.createElement(‘link’); = “Css” + i;
link.rel = ‘stylesheet’;
link.type = ‘text/css’;
link.href = string.split(“,”)[i].toString();
document.getElementsByTagName(‘head’)[0].appendChild(link); //Load CSS file pro-grammatically.
var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);
var FieldHtml=”<p><div id=’colorSelector’><div style=’background-color: #0000ff’></div></div></p>”
return FieldHtml;

function postRenderHandler(ctx)
if(ctx.ListSchema.Field[0].Name == “Color”)
color: ‘#0000ff’,
onShow: function (colpkr) {
return false;
onHide: function (colpkr) {
return false;
onChange: function (hsb, hex, rgb) {
$(‘#colorSelector div ‘).css(‘backgroundColor’, ‘#’ + hex);




Once your HTMl Control render successfully on page after that you can get that control using this property with out _postback, So you can manipulate with the control’s value property .

It’s amazing datepicker control .


You can see the output.

If have any query or suggestion  regarding code , feel free to ask.


Happy Coding 🙂

Sharepoint Error “A type named ‘SP.Data.DemoYourListItemas’ could not be resolved by the model. When a model is available, each type name must resolve to a valid type.” While adding list item in list using REST API

Hello Developers..

Today while playing with REST API i got some mysteries error like “A type named ‘SP.Data.DemoListItemas’ could not be resolved by the model. When a model is available, each type name must resolve to a valid type.

After working on it i found solution and cause of due to which error occur.

Let me tell you that this error occur during inserting list item in list using REST API. While adding item in list we must pass “ListItemEntityTypeFullName” of list so that REST API can know type of list.

So now question is that how to find ListItemEntityTypeFullName of list.

You need to make REST query and fire in as url like:


Run this REST url in browser. You will get ListItemEntityTypeFullName in output.

FireShot Capture -  - http___bidsp03_1000_student_StudentRecords__api_Web_Lists_GetByTitle('todol

Now add this list type in your REST Query.

var listurl = _spPageContextInfo.webAbsoluteUrl + “/_api/Web/Lists/GetByTitle(‘ListItem’)/Items”;
var data = {
__metadata: { ‘type’: ‘SP.Data.ListType‘ },

url: listurl ,
type: “POST”,
async : false,
headers: {
“accept”: “application/json;odata=verbose”,
“X-RequestDigest”: $(“#__REQUESTDIGEST”).val(),
“content-Type”: “application/json;odata=verbose”
data: JSON.stringify(data),
success: function (data) {
error: function (error) {

Now you will not get any error like this while adding item in list using REST API.

Happy Coding…!!