Wednesday, April 16, 2014

SharePoint 2010 Interview Questions and Answers (Part - 2)

How many types of master pages in SharePoint 2010?There are total three types of master pages in SharePoint 2010:
  1. V4.master: This is default team site master page which provides ribbon bar and other editing features using UI.
  2. Default.Master : Sites which are upgraded from SharePoint 2007 to SharePoint 2010 uses this master page unless they are changed to use a v4 version.
  3. Minimal.master : These masterpages normally referred to as Starter Master pages in SharePoint 2010.
What are the things deployed as a sandbox solution in SharePoint 2010?Developers can deploy below things as a sandbox solution
  1.  WebParts.
  2.  Event Receivers.
  3. List Definitions.
  4. Workflows.
How many types of client object model extension available in SharePoint 2010, what is the criteria to use one or the other?There are three types of client object model extension has been introduced in the Microsoft.SharePoint.Client namespace. These three extensions are targeted for three different types of clients.
  1. .Net Managed Application : These are mostly used while developing console or windows application and also web applications which are not running into SharePoint context.
  2. Silverlight Applications
  3. ECMAScript : It is an extension using javascript or Jscript. These are mostly used for the applications which are hosted inside SharePoint.
How does user access ECMAScript object model API’s ?
The ECMAScript library is available in a number of JS file in the layouts folder. The main file among all the js files is SP.JS file. When a developer includes this file in the page all other JS files are loaded automatically. By linking SP.js to the page, the SP namespace is registered. SP is the SharePoint namespace that contains all objects. For debugging purposes, every js file also has a ‘debug’ equivalent in the same folder.
How many authentication methods are available for the client object model application ?
There are three authentication methods available while working with the client object model in SharePoint 2010:
  1. Anonymous
  2. Default
  3. FormsAuthentication
Developer needs to specify what authentication method in the code, if the developer didn’t mention the application will by default start using windows credentials ( i.e Default Credentials)
What is the main difference between Load() and LoadQuery() methods ?Load method basically used to populates client object directly from what it gets from the server i.e. a collection object like ListItemCollection etc. But Loadquery method returns totally new collection in IEnumerable format. The other difference is that the collections which Load method uses are eligible for garbage collection only when the client context variable goes out of scope whereas , in LoadQuery() method collection it goes out of scope at the end of IEnumerable<List>list.
What exactly the purpose of calling clientContext.ExecuteQuery() method?ExecuteQuery() method is used in the client object model, it basically used to avoid number of round trips to the server and all the components loaded into the clientcontext are executed in one go.
What is REST in SharePoint 2010 and how it is used ?
REST (Representation State Transfer).  It is basically a protocol which is powered by ADO.Net services which is used to get data out of the SharePoint via URL like webservices. It is also used to access data from the SharePoint even when the user is not in SharePoint context providing proper credentials.
What data type does REST return?It returns an XML output.
What is GAC ?GAC is a Global assembly cache folder on the server hosting SharePoint where user places their assemblies which needs to be used globally.
What is CAML ?
CAML is a Collaborative Application Markup Language and it is based on XML which is used in Microsoft Windows SharePoint services to define sites and lists. For example , fields, views, or forms, but CAML is also used to define tables in the Windows SharePoint services during site provisioning.
What is the benefit developer gets when they use LINQ over CAML for data retrieval?Unlike CAML, using LINQ to SharePoint provider, developers are mostly working with strongly types list item object. Suppose an item in the Announcement list is an object of type Announcement and an item on a Task list is an object of type task. Developer can then enumerate these objects and get the properties for their use. In addition, developer can take benefit of LINQ syntax and LINQ keywords which are much easier and sophisticated built in C# and VB for LINQ queries.
What are the main disadvantage of using LINQ in the code ?
Basically what LINQ does is it translates the LINQ queries in Collaborative Application Markup Language(CAML) queries which adds an extra step to retrieve the data
What exactly does RunWithElevatedPrivileges in Server Object model does ?Sometimes there are certain object model can call another model which requires site-administration privileges. To bypass the access-denied error we are using RunWithElevatedPrivileges. When a non-privileged  user initiates any request so at that time we can successfully make calls to the object model by using RunWithElevatedPrivileges method property provided by the SPSecurity class.
How to create a Content Type ?
Content type can be created in three ways,
1. SharePoint Foundation interface
2. SharePoint foundation object model
3. Deploying a feature that installs the content type based on an XML definition file.
How content type is deployed?
Content type can be associated with list or library and can be deployed using feature. Inside the Feature, it contains a feature.xml file which contains all the references to all the elements manifests within that Feature. Content type definitions are element manifests.
What exactly the scope of content type ?
Site
Is it possible to derived list definition from a custom content type ?Yes it is possible; It can be seen in the schema.XML of the list definition in the element.
While creating a list definition, how can a user create an instance of the list? 
User can create a new instance of a list by creating an instance.XML file
What is ghosted page in SharePoint 2010?
The page which is not stored in the content database instead it refers to a file which resides on the server’s file system.  These reference files are common for the site collections and Web applications within the SharePoint server.  If user modifies a reference file then that change will reflect in all the site collection within that SharePoint server automatically.
What is Un-ghosted page?All the pages which are stored in the content database are referred to as un-ghosted pages. All the un-ghosted pages are specific to that SharePoint web application only. i.e. changes done in an un-ghosted page will not reflect in other web applications within that SharePoint server.
How many types of pages available in SharePoint 2010?
Two types of pages are available in SharePoint 2010,
1.Application Page
2.Site Page
What are application pages in SharePoint 2010?
Application pages are stored on the file systems on the front end web servers in the layout directory. They allow in line code without restriction. Dynamic webparts or webpart zones cannot be created on application pages or they cannot modify on SharePoint Designer. Application pages are not stored in the content database. They never run in safe mode. As application pages reside on file system they cannot be used in sandbox solution.
In what scenarios we can use application pages?
1. Administrative pages
2. To capture data
3. Configuration pages
4. To restrict user to customize the page
5. with any site or site collection or web application on same server
6. When we want to add custom code or inline code to the page
What are the basic differences between site page and application page ?
S. NoApplication PagesSite Pages
1
Pages are stored in the file system.Pages are stored in the content database
2
Application pages cannot be used with Sandbox solutionsSite pages are used with Sandbox solution
3
Application pages cannot be edited in SharePoint DesignerSite pages can be edited in SharePoint Designer
4
An application page cannot be modified by end user for that developer is a must.Site pages can be edited by end user.
5
Inline code is used in Application pagesInline code cannot be used in Site Pages.
Is it possible to add web parts and web zones into an application page ?No, application pages does not support edit mode but static web parts can be added by editing them in visual studio.
How to edit an Application page?An application page can be edited in two way i.e Visual studio and notepad. However in both ways we need to deply application page again for further usage.
If a page with some code has to be deployed, which type of page should be selected?Application page should be selected.
What are the ways to create custom Master page ?
There are multiple ways to create custom master page files,
1.By SharePoint Designer
2.By editing minimal.master using any editor
3.By copying and editing existing master page
More at our blog here -  SharePoint 2010 Interviews