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.

Search Architecture Key points

Search :
Level
 1.web application
 2.site level
 1.webapplication when user creates using search center
 we need to config central admin
 1.incremental crawl -last updated items (we can set time every half/one hour user defined)
 2.full crawl -all items in web application (weekly once or day-wise ) Affects machine processing
 3.continous crawll -Each crawl dynmacally runs step by step Each process run serial process We need to create first search center in our webapplication under the subsute sitecollection-SharePoint Server Publishing Infrastructure manage site feature--sharePoint Server Publishing

Wednesday, July 29, 2015

how to remove Everyone permission for SP site and get SP users in sharepoint powershell

Add-PSSnapin Microsoft.SharePoint.PowerShell
Get-SPUser -web "http://raghu:2015/"


Remove-SPUser "c:0(.s|true" -web "http://raghu:2015/"

Tuesday, July 21, 2015

How to get login user Manager In SPServices In SHarepoint 2013

<script type="text/javascript">
$(document).ready(function() {


var managerName;
        var userName = $().SPServices.SPGetCurrentUser();
        $().SPServices({
            operation: "GetUserProfileByName",
            async: false,
            AccountName: userName,
            completefunc: function (xData, Status) {
                managerName = $(xData.responseXML).text();
                var managerLength = managerName.length;
                var indexofManager = managerName.indexOf("Manager");
                managerName = managerName.substring(indexofManager + 13, managerLength);
                var indexOffalse = managerName.indexOf("false");
                managerName = managerName.substring(0, indexOffalse);
            }
        });
        alert(managerName);
       
});
 UserProfile_GUID
- AccountName
- FirstName
- LastName
- PreferredName
- WorkPhone
- Office
- Department
- Title
- Manager
- AboutMe
- PersonalSpace
- PictureURL
- UserName
- QuickLinks
- WebSite
- PublicSiteRedirect
- SPS-Dotted-line
- SPS-Peers
- SPS-Responsibility
- SPS-Skills
- SPS-PastProjects
- SPS-Interests
- SPS-School
- SPS-SipAddress
- SPS-Birthday
- SPS-MySiteUpgrade
- SPS-DontSuggestList
- SPS-ProxyAddresses
- SPS-HireDate
- SPS-LastColleagueAdded
- SPS-OWAUrl
- SPS-ResourceAccountName
- SPS-MasterAccountName
- Assistant
- WorkEmail
- CellPhone
- Fax
- HomePhone

Friday, July 17, 2015

Freeze header in SharePoint List using JQuery?

Code:
Replace user list id
{B7EDD228-FDD2-46D2-A47E-E33D1D27E612}-{80AB3567-18AE-4ACE-A8E5-C86E5285E9C9}
<script type="text/javascript">

$(document).ready(function(){
var SummaryName ="Employee";
$("table").each(function(){
  var curTable = $(this).attr('id');

  if (curTable  == "{B7EDD228-FDD2-46D2-A47E-E33D1D27E612}-{80AB3567-18AE-4ACE-A8E5-C86E5285E9C9}"){

var $hdr = $("tr.ms-viewheadertr:first", $(this));
$(this).wrap("<div class='fh-tableWrapper' />");
$('.fh-tableWrapper').wrap("<div class='fh-outerWrapper' />");
$('.fh-outerWrapper').prepend("<div class='fh-bg' />");
$('th',$hdr).wrapInner("<div class='fh-thContentWrapper'/>");
$hdr.addClass("fh-thRow");
$(this).addClass('fh-table');

  }
});

});

</script>
<style type="text/css">

.fh-outerWrapper
{
    position:relative;
}

/* table wrapper*/
.fh-tableWrapper
{
    overflow:auto;
    height:300px;
}

/*the wrapper for 'th' content*/
.fh-thRow .fh-thContentWrapper{
    position:absolute;
    top:0;
}
.fh-bg
{
    position:absolute;
    top:0;
    height:30px;
    width:100%;
    background-color:#D5ECFF;

}

</style>

Thursday, July 16, 2015

How to particular site collection move new content database SharePoint Powershell Script

move-spsite "http://raghuspsserver/" -DestinationDatabase "raghu_contentdbnew"

Saturday, July 4, 2015

Do and Don't do n SharePoint Developement ,Best practices In SharePoint 2013,2010

When creating new columns, name them without any special characters or spaces.  After the column is created, rename it with the special characters or spaces.  This way the internal name is "clean".
When you are working with DataViews, some third party controls, and custom Webparts - you must use the internal name.  The potential for confusion is enormous.
When you are adding sites and pages make sure their names don't have spaces.

URLs
When adding pages or sites to your navigation, always browse to the intended destination; this will ensure your tabs will work properly.  In fact if you compare the resulting URL after you fix a broken tab this way, you will see that the URL must be relative, not absolute.

Use the same practice of giving the relative URL instead of the absolute URL in the Content Editor Webpart or Master Pages or in any other circumstance where you are required to provide the URL.

Whenever there is a requirement to change the URL in the Master Page wherein the Mater Page has been deployed as a feature, always change the link in the Master Page which is residing inside the Feature Folder and do not use SharePoint Designer to open a Site and Change the Link.

Backup/Restore or Export/Import

Never use Back Up and Restore procedure if you are trying to restore a Site Collection which is using Collaboration Portal, instead use Export and Import.

Same applies to saving of a collaboration site as template. MS does not support this.

STSADM
Get familiar with the various stsadm.exe commands. It helps a lot and saves time.
STSADM commands has been deprecated and will not be supported in future releases of Microsoft Sharepoint Foundation 2010.

SP Designer
Avoid using SharePoint Designer to edit any page design as much as possible. This causes a lot of performance issues.

Hive older backup
Please take the backup of the 12/14 hive if you are trying to do any changes inside the 12/14 hive.

Rollback Plan

Always have the rollback plan ready whenever you are deploying anything on the web server as SharePoint is very unstable so you would never know what is causing the problem very soon.

General
Learn to use the SharePoint object model efficiently.

Make sure that you always Dispose() the SPSite and SPWeb object in the finally block of your code.

Whenever you are required to loop through something, use for loop instead of foreach loop.

Try to avoid looping as much as possible. See if the same can be achieved through CAML query or SiteData Query or by using Search Object Model which actually fires the query on the crawled results.

Even if you are looping, try to reduce the number of loops as much you can.

Modularize your code and divide them into different parts depending on their functionality. Do not write bulky code.

Always put all your functions in try-catch block.

Never do any sort of Hard-Coding in your code.

Whenever there is more than one content DB for a web application for any reasons. Make sure that all the newly created sites goes to a particular content DB only and the data should not be going randomly to all the content DB’s. You can do this by setting the limitation for the number of sites in one of the content DB where you do not want the new data to go.

Make use of time bound caching wherever you are not required to show the real time data. Also you can use caching when you’re are pulling out data from a database and showing it in your Webpart. You have to set the Sql Dependency for the same.

Using Objects in Event Receivers
Do not instantiate an SPWeb, SPSite, SPList, or SPListItem object within an event receiver. Event receivers that instantiate these objects instead of using the instances passed via the event properties can cause the following issues:

Significant additional round-trips to the database (one write operation can result in up to five additional round-trips in each event receiver).
Calls to the Update method on these instances can cause subsequent Update calls in other registered event receivers to fail.
Usage of OOB files

Do not change OOB files. OOB files can be .aspx, .ascx ,.xsl, .xml, .js,.css  etc under 14 hive directory. Changing OOB can cause huge issues which cannot be traceable and changes will be visible to all applications that are running in the farm. If you want to use OOB files for customization purpose, create new folders, make a copy of the file and have it in the new folder and customize it.
For example,
If you wanna use/customize approve.aspx, create a new folder under  1033/layouts/<application name> , copy approve.aspx from 1033/layouts/ and paste it under 1033/layouts/<application name> and then customize it.

Saturday, June 27, 2015

SharePoint - How to Check Disk Space Usage

To determine your disk space usage: 
1. Click on "Site Settings". 
2. Click on "Go to site admin"
3. Click on "View Site Collection Usage Summary" - note that the maximum amounts listed may not agree with those outlined for your hosting plan. The amounts listed for your hosting plan are the correct limits. 
4. "View Storage Space Allocation" can help you determine exactly where space is being used. 

Bulit-in feature in Sharepoint for monitoring Sharepoint disk space usage


Types of SharePoint Log Events
  • Unified Logging System (ULS) 
  • Trace Logs 
  • Windows Event Logs 
  • Logging Database 
  • Health Analyzer 
  • Timer Jobs 


Unified Logging System (ULS) 

Eye for sharepoint and each event Report generating

We can see three ways:

  • SharePoint trace logs
  • Windows Event Log
  • SharePoint logging database

     Trace logs

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15
    The naming format for the trace log files is machinename-YYYYMMDD-HHMM.log, in 24-hour time.
     By default, a new log file is created every 30 minutes.
     You can change the interval by using Windows PowerShell with the Set-SPDiagosticConfig command. 
    The following powershell code snippet configures SharePoint to create a new trace log every 60 minutes.
    Set-SPDiagnosticConfig Set-SPDiagnosticConfig -LogCutInterval 60
    Get-SPDiagnosticConfig outputGet-Help set-SPDiagnosticConfig -ExamplesSet-SPDiagnosticConfig -LogLocation e:\Logs


    SharePoint LogLevel:
    Get-Command -Noun SPLogLevel

    Using SPLogEvent and SPLogFile:

    Get-SPLogEvent | Select -First 5
    Get-SPLogEvent | Select -Last 5
    Get-SPLogEvent | Select -First 20 -Last 10


    In Central Administration, click Monitoring on the left, and then select Configure Diagnostic Logging under the Reporting section
  • users reset logging Reset to default setting
Moving trace logs

Logging Database
  1. Search Queries
  2. Timer Jobs
  3. Feature Usage
  4. Content Import Usage
  5. Server Farm Health Data
  6. SQL blocked queries
  7. Site Inventory
  8. Search Query statistics
  9. Page Requests
  10. Site Inventory Usage
  11. Rating Usage
  12. Content Export Usage
  13. NT Events
  14. SQL high CPU/IO queries
  15. Search Crawl
  16. Query click-through

Powershell
get-command -noun spusage*
Set-SPUsageApplication -DatabaseServer <Database server name>
-DatabaseName <Database name> [-DatabaseUsername <User name>]

[-DatabasePassword <Password>] [-Verbose]
Health AnalyzerIn Central Administration, you click Monitoring and then select Health Analyzer.
Timer JobsGet-Command -noun SPTimerJob

Monday, June 22, 2015

What is Form Based Authentication?Why ?FBA Limitations?

Form Based Authentication (FBA) provides your own authentication method using a web form. More and more companies are using FBA as a way of extending a site for non-Active Directory (AD) users.

SharePoint standard installation uses as default AD to query the Domain Controller and to check user credentials through Windows Authentication. FBA uses a custom database created separate from AD to store user credentials. Authentication using FBA is executed by a SQL DB query. When FBA is used to extend SharePoint sites, external users (non AD users) have access to SharePoint.

Why would you allow access to external users? 

A practical reason for extending a SharePoint site through FBA is collaboration on documents with your clients or vendors.

FBA Limitations
Users who authenticate with FBA do not have the same level of functionality available as users who authenticate with a Windows Authentication method. Basically the client integration features would not work:

– Links that start client applications are not visible
– Documents are opened directly in the browser with no client applications support
– Users cannot edit documents on the site using the client applications. However, users can download and edit the document locally, and then upload the document back to the serve

Monday, June 15, 2015

Script to clear User Information List


while restoring site back ups, all users from orgin server would be there in destination server which requires some effort for removing. A simple SharePoint PowerShell script to clear the user information list, which in turn removes all users from all groups but not from lists
 $url = “http://sitecollection”
$web = get-spweb $url
 $list = $web.Lists["User Information List"]
 $listItems = $list.Items
 $listItemsTotal = $listItems.Count
 for ($x=$listItemsTotal-1;$x -ge 0; $x–-)
 {
 Write-Host(“DELETED: ” + $listItems[$x].name)
 remove-spuser $listItems[$x]["Account"] -web $url -confirm:$false
 }
 $web.dispose()

Thursday, June 11, 2015

Minimum requirements Development, Database Sever,Application Server or Web Server in SharePoint 2016

Below are few System Requirements for SharePoint 2016:
Scenario  Deployment type:
=====================
Processor
RAM
Hard disk
Database server running a single SQL instance
====================================
 Development  64-bit,
 4 cores
 12-16 GB
 80GB
 Database server running a single SQL instance
===============================
 QA/Production  64-bit,
4 cores
16-24 GB
  80GB  
Web server or application server in a three-tier farm
===================================
Development  64-bit,
 4 cores
 12-16 GB
 80GB
Web server or application server in a three-tier farm
====================================
 QA/Production  64-bit,
 4 cores
 16-24 GB
 80GB   

Tuesday, June 9, 2015

Hardware and Software requirements SharePoint 2016 Server?

One more important thing is there will be no SharePoint 2016 Foundation, there will be only SharePoint 2016 Server.


Overall few things are same like SharePoint 2016 requires 64 bit processor with 4 cores. And also RAM 12 to 16 GB.

Below are few System Requirements for SharePoint 2016:

Scenario
Deployment type
Processor
RAM
Hard disk
Database server running a single SQL instance
Development
64-bit, 4 cores
12-16 GB
80GB
Database server running a single SQL instance
QA/Production
64-bit, 4 cores
16-24 GB
80GB
Web server or application server in a three-tier farm
Development
64-bit, 4 cores
12-16 GB
80GB
Web server or application server in a three-tier farm
QA/Production
64-bit, 4 cores
16-24 GB
80GB

Prerequisites for SharePoint 2016:
Below are the prerequisites required to install SharePoint 2016. Like SharePoint 2013, SharePoint 2016 has a Prerequisite Installer (prerequisiteinstaller.exe) which will install the required components.

- Application Server Role, Web Server (IIS) Role.
- Microsoft SQL Server 2012 Native Client
- Microsoft ODBC Driver 11 for SQL Server
- Microsoft Sync Framework Runtime v1.0 SP1 (x64)
- Windows Server AppFabric 1.1
- Cumulative Update Package 1 for Microsoft AppFabric 1.1 for Windows Server (KB2671763)
- Microsoft Identity Extensions
- Microsoft Information Protection and Control Client 
- Microsoft WCF Data Services 5.0
- Microsoft WCF Data Services 5.6
- Microsoft .NET Framework 4.5.2
- Update for Microsoft .NET Framework to disable RC4 in Transport Layer Security (KB2898850)
- Visual C++ Redistributable Package for Visual Studio 2013

Operating System Requirement:
SharePoint Server 2016 will be supported on Windows Server 2012 R2 and Windows Server Technical Preview.

.Net Framework:
Windows Server 2012 R2: SharePoint 2016 requires .NET Framework 4.5.2
Windows Server Technical Preview "Threshold": SharePoint 16 requires .NET Framework 4.6 Preview, which comes with Windows Server Technical Preview "Threshold".

Database Requirements:
SharePoint Server 2016 requires SQL Server 2014 or SQL Server 2016.

Deployment Scenarios:
Below are the deployment Scenarios which are supported or not supported in SharePoint 2016:

Workgroup: Unsupported
Domain Controller: Developer Installation
Client OS: Unsupported
Dynamic Memory: Unsupported
Windows Web Server: Unsupported
--Copied From Google 

Removing start.aspx error or MDS Feature?

the URL with _layouts/15/start.aspx because the new feature Minimal Download Strategy is activated on your site. 


Currently in my Sharepoint Site, when I want to go to the main page sharepoint/SitePages/Home.aspx, it actually ends up going to sharepoint/_layouts/15/start.aspx#/SitePages/Home.aspx.


this Feature Improve Navigation, Fast Rendering on Client Browser, and Reduce page Loading time Because is not going to fetch Duplicate Data from Sever.


 Site Settings  Ã   Site Actions à   Manage Site Featuresà   
Deactivate Minimal Download Strategy Feature.

Wednesday, May 27, 2015

Custom css in List Items


How to activate the V2VPublishedLinks in SharePoint 2013?


Enable-SPFeature –identity V2VPublishedLinks -URL http://YourWebApp


Install-SPFeature V2VPublishedLinks