Friday, 6 October 2017

Custom Display Templates In SharePoint 2013

Display templates control which managed properties are shown in the search results, and how they appear in the Web Part.

Each display template is made of two files:

  1.  HTML version of the display template that you can edit in your HTML editor,
  2.  .js file that SharePoint uses

CSWP uses combination of two Display Templates, Control Templates and Item Templates to render results. 
Control Template provides HTML to structure the overall layout for how you want to present the search results.

For example, the Control Template might provide the HTML for a heading, beginning and end of a list. The Control Template is rendered only once in the Web Part.

Item Template provides HTML that determines how each item in the result set is displayed.

For example, the Item Display Template might provide the HTML for a list item that contains a picture, three lines of text that are mapped to different managed properties associated with the item. The Item Display Template is rendered one time for each item in the result set.
So, if the result set contains ten items, the Item Display Template creates its section of HTML ten times.

  • Display templates are HTML and JavaScript rather than XSL
  • Display templates are configured for the Site and Site Collection rather than for a Web part
  • Display templates are applied with rules and logic
  • Display templates are applied to individual result items, not the entire result set
  • Display Templates are used for Results of all kinds, search results, content by search results, and refiners

For More Details Follow this below Links: 

Friday, 28 July 2017

SharePoint Interview Questions

Event Receivers……

1.         What is event receiver?
An event receiver is a piece of managed code that responds to SharePoint events when specific triggering actions occur on a SharePoint object. Triggering actions include activities such as adding, updating, deleting, moving, checking in, and checking out.
Event Receivers has taken places either synchronously or asynchronously. If the action has taken before code execution. All receivers that end with “ing” are synchronous and those which end with “ed” are asynchronous.
Synchronous Event Handlers will work before the event is completed while asynchronous event handlers will fire after the event is completed.  
Synchronous events
·         Occur before the event.
·         Block the flow of code execution until your event handler completes.
·         Provide you with the ability to cancel the events resulting in no after event (“…ed”) being fired.
Asynchronous events:
·         Occur after the event.
·         Do not block the flow of code execution in SharePoint
Note:-Event Handlers should be placed in GAC only.

2.What is the base class for List events and List Item events?

The Base class for SharePoint events is   Microsoft.SharePoint.SPEventReceiverBase. The List and List Item events inherited based on the scope of event host as below.
  List Item            : Microsoft.SharePoint.SPItemEventReceiver
  SharePoint List :  Microsoft.SharePoint.SPListEventReceiver
3. Cancel  the actions using event receiver?
SharePoint before events(synchronous) can be cancelled since it get trigged before completing the operation. Any validation can be applied as well as the event can be cancelled using event properties.
public override void ItemAdding(SPItemEventProperties properties)

4.What is the difference between event receiver and workflow?
·         SharePoint Workflow consist a set of task(s) which can be triggered both manually and automatically.
·         SharePoint Workflows are created in SharePoint Designer, Microsoft Visio and of course through Visual Studio.
·         The workflow is triggered once an action is completed.
·         Workflow can be exported and imported
·         Workflow can be paused
·         Workflow can send mails without attachment
·         Does not required coding knowledge to work on SPD workflows
·         Multiple forms(initiation, task edit..) can be associated as part of workflow
Event Receivers:
·         SharePoint event receiver contains custom coding/logic which can be triggered automatically based on the event host type.
·         SharePoint event receivers can be created only in Visual Studio.
·         The events can be triggered before action or after action.
·         Events cannot be exported and imported
·         Events can be cancelled(synchronous) but cannot be paused
·         Even receivers  can send mails with attachment
·         Required coding knowledge
·         No custom forms associated as part of event actions

5.  Why can’t we use SPContext in even receiver?
The event properties should be used to get the current SPContext. If we get the current context of the site in different object  like SPContext then your connection may get lose when your dispose the site context.  Use SPItemEventProperties.Site/SiteID properties to get the current context or use SPItemEventProperties.Context property.

6. Can event receiver deployed as sandbox solution?
Yes, Event receivers can be deployed as sandbox solution. But make sure that your custom code is not using RunWithElevatedPrevillege method. Sandbox solution only can access the site collection object and it cannot access other than site collection object, network resources, database
7. What are the new event receivers added in SharePoint 2010?
Event Host Type
Existing Events
New Events
Events Base Class

7. What is impersonation, and when would you use impersonation?

Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.
What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

 If I wanted to not allow people to delete documents from a document library, how would I go about it?

You would on the ItemDeleting event set: properties.Cancel= true.

When running with SPSecurity.RunWithElevatedPrivileges (web context) what credentials are being used?

In a web context, this is the application pool identity. In a timer job and workflow, this will be the 'Windows SharePoint Timer Services' identity.
When should you dispose SPWeb and SPSite objects? And even more important, when not?
You should always dispose them if you created them yourself, but not otherwise. You should never dispose SPContext.Current.Web/Site and you should normally not dispose SPWeb if IsRootWeb is true. More tricky constructs are things along the line of SPList.ParentWeb.
Also dispose each web when iterating over SPWeb.Webs
Also dispose SPLimitedWebPartManager's SPWeb property (.web)

Timer Jobs….

How can debugging share point application and timer jobs ? with steps?
1.     build application place .dll into gac and reset iis
2.     On the Debug menu, select Attach to Process
3.     select the Show processes from all users 
check box.
4.     select W3W.exe and OSWTIMER.exe can attach
5.     refresh SharePoint site point break point.

Thursday, 27 July 2017

SharePoint 2013 Interview Questions

This article will help you to get all SharePoint questions in a common place.
Reference: MSDN

What is SharePoint?
SharePoint is a web-based, collaborative platform that integrates with Microsoft Office. Launched in 2001, SharePoint is primarily sold as a document management and storage system, but the product is highly configurable and usage varies substantially between organizations.
SharePoint 2013 is a collaboration environment that organizations of all sizes can use to increase the efficiency of business processes. SharePoint 2013 sites provide secure environments that administrators can configure to provide personalized access to documents and other information.
Organizations use SharePoint to create websites. You can use it as a secure place to store, organize, share, and access information from any device.
SharePoint Online     A cloud-based service, hosted by Microsoft, for businesses of all sizes. Instead of installing and deploying SharePoint Server on-premises, any business can subscribe to an Office 365 plan or to the standalone SharePoint Online service. Your employees can create sites to share documents and information with colleagues, partners, and customers. To get started storing your files on your team site, see Set up Office 365 file storage and sharing. Give Office 365 a try.

SharePoint Server       Organizations can deploy and manage SharePoint Server on-premises. It includes all the features of SharePoint Foundation. And it offers additional features and capabilities, such as Enterprise Content Management, business intelligence, enterprise search, personal sites, and Newsfeed. Give SharePoint Server 2016 a try.

SharePoint Object Model Hierarchy?
SPFarm: The SPFarm object is the highest object within the Windows SharePoint Services object model hierarchy.
SP SERVER: The Server object represents a physical server computer. The service instances property provides access to the set of individual service instances that run on the individual computer.
SPWebApplication: Each SPWebApplication object represents a load-balanced web application based in Internet Information Services (IIS).
SPSiteCollection: An SPSiteCollection object represents the collection of site collections within the web application.
SPLIST: Each SPList object has members that are used to manage the list or access items in the list.

ITEMS: Each SPListItem object represents a single row in the list.
What is Share Point List?
SharePoint list is a container for information, similar to a very simple database or spreadsheet. Using a list is the most common way to manage information in a SharePoint site. In a list, data is gathered in rows, and each row is known as a list item.
SharePoint Columns?
A column represents an attribute, or piece of metadata, that the user wants to manage for the items in the list or content type to which they added the column. A site column is a reusable column definition, or template, that you can assign to multiple lists across multiple SharePoint sites.
What is a site column in SharePoint 2013?
A site column is a reusable column definition, or template, that you can assign to multiple lists across multiple SharePoint sites. Site columns are useful if your organization wants to establish some consistent settings across lists and libraries.
SharePoint Column Types?
You can create a list column, which exists only within a specific SharePoint list. You can also create a site column, which is defined at the site collection level and is made available for use in lists and content types across the site collection, including all subsites.
SharePoint Content Type?
A content type is a reusable collection of metadata (columns), workflow, behaviour, and other settings for a category of items or documents in a SharePoint list or document library. Content types enable you to manage the settings for a category of information in a centralized, reusable way.
What is content type hub in SharePoint?
SharePoint introduced a new feature called Content Type Hubs to solve it.Content Type Hub is a central location where you can manage and publish your content types – so now web applications can subscribe to this hub and pull down the published content types from the hub.
What is a document set?
A Document Set is a group of related documents that can be created in one step and then managed as a single entity.
A Document Set is a special kind of folder that combines unique Document Set attributes, the attributes and behavior of folders and documents, and provides a user interface (UI), metadata, and object model elements to help manage all aspects of the work product
Part 2 –SharePoint Search, Central Admin ,Services etc  ..
More Question & Answers..

Friday, 2 June 2017

Why would one use K2 for SharePoint?

Easy to build

Designers and developers can quickly build workflows in SharePoint using K2's drag-and-drop design tools. Wizards help you configure common SharePoint workflow scenarios, and designs can be easily shared, facilitating real-time collaboration with colleagues. Workflows can for example be created for document approvals or even list item publishing. Escalations can be configured per task in workflows. A task can also be send back to a previous step in the workflow as a rework step.

Span SharePoint Environments

With K2, workflows are not restricted to a single SharePoint site. They are designed to work with SharePoint lists and libraries across multiple sites. Workflows can even span across SharePoint versions, including SharePoint Online for cloud-based scenarios.

Access tasks anywhere, anytime

K2's mobile applications and options allow your team to access workflow tasks from their phone or tablet. There they can take action, delegate, check in on process status or find the information they need to make important decisions.

You are in control

K2's custom logic and rules engine gives you the power to build SharePoint workflow applications that fit your business needs precisely. Tracking and monitoring tools provide visibility, and making quick and easy application changes.

Quickly create elegant forms

Build intuitive, easy-to-use forms from within a browser. K2 forms can be automatically generated from SharePoint document libraries and lists then customized, if necessary. Every K2 form is reusable, so you'll save time and ensure consistency.

Use the information you already have

K2 makes it easy to bring line-of-business data into your SharePoint workflows and forms. K2 applications respect the security you have in place and allow the data to remain where it lives. K2 supports Microsoft CRM,, Active Directory, Exchange, SAP, SQL Server, Oracle and anything accessible by web services.

Friday, 31 March 2017

Save site as template option isn't available in SharePoint Online in Office 365 or SharePoint Server 2013

When you browse to the SharePoint Online or SharePoint Server Site settings page, you discover that the Save site as template option isn't available.


his issue most frequently occurs because the Community Sites Feature site feature, the SharePoint Server Publishing site feature, or the SharePoint Server Publishing Infrastructure site collection feature is currently enabled or was previously enabled for the affected site.

SharePoint doesn’t support creating a template from a site where publishing or community features were enabled. This is because the publishing feature creates site elements that are not supported as part of a template, and these elements remain even when the feature is disabled. This also includes templates that were created through SharePoint Designer.

Note Although the Save site as template option may become available after you deactivate publishing features, it is still unsupported to create a template from a site that has ever had publishing features enabled. If you create a site from this template, you may encounter problems when you try to activate publishing on the new site. For example, you may receive the following error message:
Provisioning did not succeed. Details: Failed to initialize some site properties for Web at Url: '......' OriginalException: Failed to compare two elements in the array.
In SharePoint Online, if you disabled scripting capabilities for the affected site, this also removes the Save site as template option. For more information, go to the following Microsoft website:

Although you can't use the Save site as template option in this scenario, you can use the app model to customize the provisioning process in SharePoint Online or SharePoint Server 2013. This lets you enable specific features, capabilities, and branding for your sites.

Error configuring PowerPivot 2012 on SharePoint 2013. New-PowerPivotSystemServiceInstance - The PowerPivot System Service does not exist in the farm

This is the PowerShell output if I run that command on its own:

PS C:\Users\sharepointsetup> New-PowerPivotSystemServiceInstance -Provision:$true New-PowerPivotSystemServiceInstance : The PowerPivot System Service does not exist in the farm. At line:1 char:1 + New-PowerPivotSystemServiceInstance -Provision:$true + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Analy...ServiceInstance: NewPowerPivotMidTierServiceInstance) [New-PowerPivotSystemServiceInstance] , GeminiException + FullyQualifiedErrorId : Microsoft.AnalysisServices.SPAddin.PowerShell.NewPowerPivotMidTierServiceInstance
Configure Local Service Instances,
  • -Register PowerPivot System Services on local server
  • -Cannot create the service instances because the parent service doesnot exist
  • -Prerequisites check for execution filed. Farm is not in a valid state. in powerpivot by doing
Before installing or trying to install powerpivot in sharepoint 2013--
create secure store service key for powerpivot -- by going to CentralAdmin>secure store service>New and give name to target application ID-Powerpivotunattendedaccount, display name- Power pivot unattended account data refresh, contact email address, select none for target application name and click next. In the 1st field name type- username and field type a windows username, 2nd field type as - password and field type windows password and click next and provide admin account username name. Now go to download spPowerPivot installer Here and install the installer and open the power pivot configuration tool and follow the instructions.
or if you are using sql server 2012 standard version after installing the sp installer go to tools in the sql server 2012 and click configure powerpivot and follow instructions.

Create Sites, Lists and Libraries in SharePoint 2016