infopath file extension - .xsn
List or Library template - .stp
site template extension - .wsp
Asp.net Server object model - .wsp
Silverlight Client object model -.xap
Add content type to SharePoint List/Library using REST API Use this below code to add content type to SharePoint Library using REST API. For this you need to use the content type ID. Below function will get the content type ID from content type name & we will pass the content type id to next function which will update content type to list/library. var varContentTypeName = " Your Content Type name "; var Listname = " Your List name where you want to add content type "; //This will get the content type ID from content type Name function getContentTypeID() { var deferred = $.Deferred(); var isCurrentUserIsApprover = false ; var serverURL = _spPageContextInfo.webAbsoluteUrl; var listURL = String.format(" {0}/_api/web/AvailableContentTypes?$select=Name,Id,StringId&$filter=Name eq '"+varContentTypeName+"' ",serverURL); $.ajax({ url: listURL, type: " GET ", async: false, headers:...
When we are trying to update task list we will get this error " A type named 'SP.Data. could not be resolved by the model error. When a model is available, each type name must resolve to a valid name must resolve to a a valid type" This happens because there is a space in the list name. To resolve this issue we need to get the exact list name to be used in "SP.Data" 1.Use the below URL in chrome browser <SiteUrl>/_api/web/lists/GetByTitle('List Name')/ For Example: https://SiteURL/_api/web/lists/GetByTitle('Workflow Tasks')/ Some times in Chrome browser you may get Authentication error. For that first open the list from your Chrome browser & then use the above URL. 2.Find "SP.Data" -> now you will get the list name that you can be used in SP.Data.ListNameListitem
In this post we will see samples about $select , $ orderby , $filter and $expand . 1.Simple API call: {siteUrl}/ _api/web/lists/getbytitle(' ListName ')/items 2.Select Columns: {siteUrl}/ _api/web/lists/getbytitle('Employees')/items? $select=ID,Title,Employee 3.OrderBy Columns: Ascending order: {siteUrl}/_api/web/lists/getbytitle('Employees')/items?$select=ID,Title,Employee& $orderby= Employee asc Descending order: {siteUrl}/_api/web/lists/getbytitle('Employees')/items?$select=ID,Title,Employee& $orderby= Employee desc 4.Filtering Columns: Filtering by Title: {siteUrl}/ _api/web/lists/getbytitle('Employees')/items? $filter= Employee eq ‘parth' Filtering by ID: {siteUrl}/ _api/web/lists/getbytitle('Employees')/items? $filter = ID eq 2 Filtering by Date: {siteUrl}/ _api/web/lists/getbytitle('Employees')/items? $filter= Start_x0020_Date le datetime'2016-03-26T09:59:32Z' Title name starts with the lette...
Comments
Post a Comment