Showing posts with label SharePoint som. Show all posts
Showing posts with label SharePoint som. Show all posts

Thursday, September 22, 2016

Using REST API For Selecting, Filtering, Sorting And Pagination in SharePoint List

 how to work with SharePoint list items, basically performing CRUD operations, using the combination of REST API 
and jQuery Ajax. The REST URI ends with any OData query operators to specify selecting, sorting, or filtering

Selecting and sorting items:

$select :

This ' /_api/web/lists/getbytitle('test')/items' url returns all items with all possible fields or list columns. 
But what if list has more than 20-30 columns?
 It’s not good practice to get all fields. 


Syntax for this is $select=Field1, Field2, Field3 
/_api/web/lists/getbytitle('test')/items?$select=ID,Title,Employee,company

'$orderby' :


The first two specify sorting in ascending order and the third one descending order.
 It's simple, you can use '$orderby' parameter and provide the field name. 
REST service will return sorted list items in response.

Syntax: for this is $orderby=(Column Internal Name order)

Ascending Order:
/_api/web/lists/getbytitle('emp')/items?$select=ID,Title,Employee,company&$orderby= Employee asc 
Descending Order:


/_api/web/lists/getbytitle('emp')/items?$select=ID,Title,Employee,company&$orderby= Employee desc  

Filtering items:

You can filter your list to contain only items which match a simple logical expression using the $filterparameter.

Syntax: for this is $filter=(Column Internal Name operator value).
See below examples,

Filter by Title

/_api/web/lists/getbytitle('emp')/items?$filter=Employee eq ‘parth'

Filter by ID:

/_api/web/lists/getbytitle('emp')/items?$filter=ID eq 2

Filter by Date

/_api/web/lists/getbytitle('emp')/items?$filter=Start_x0020_Date le datetime'2016-03-26T09:59:32Z'

Multiple Filters

/_api/web/lists/getbytitle('emp')/items?$filter=( Modified le datetime'2016-03-26T09:59:32Z') and (ID eq 2)

Title name starts with the letter P

/_api/web/lists/getbytitle('emp')/items?$filter=startswith(Title,‘P’)

Return all items from the 'emp'list modified in May

/_api/web/lists/getbytitle('emp')/items? $filter=month(Modified) eq 5

Monday, June 20, 2016

Disposing SharePoint Objects

Disposing SharePoint Objects


Yes. It's completely fine.

If you can use like below code in using block:
using(SPSite oSPsite = new SPSite("http://server"))
{
  using(SPWeb oSPWeb = oSPSite.OpenWeb())
   {
       str = oSPWeb.Title;
       str = oSPWeb.Url;
   }
}  


web.Dispose();
site.Dispose();

Wednesday, August 5, 2015

Import and Export subsite in SharePoint 2013 Using PowerShell Script

 Add-PSSnapin Microsoft.SharePoint.PowerShell


 Export-SPWeb "http://raghu/sites/test/test1" –Path "C:\rm.cmp" -includeusersecurity

 Import-SPWeb "http://raghu/sites/test/test1" -path "C:\rm.cmp" -IncludeUserSecurity

Tuesday, August 4, 2015

get SPWebTemplates Templates in SharePoint 2013

Add-PSSnapin Microsoft.SharePoint.PowerShell -ea silentlycontinue | Out-Null
Get-SPWebTemplate | ft ID, name, Title, Description -autosize -wrap








Monday, August 3, 2015

What is the full form of mdf, ldf and ndf in SQL Server?

SQL Server databases have three types of files:

Primary data files
The primary data file is the starting point of the database and points to the other files in the database. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.

Secondary data files
Secondary data files comprise all of the data files other than the primary data file. Some databases may not have any secondary data files, while others have multiple secondary data files. The recommended file name extension for secondary data files is .ndf.

Log files
Log files hold all of the log information used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf.

SQL Server does not enforce the .mdf, .ndf, and .ldf file name extensions, but these extensions are recommended to help identify the use of the file.