Monday, 9 October 2017

SharePoint Interview Questions and Answers

16. What is SharePoint 2013 site definition?.

 Site Definitions : As the name implies, A Site definition is

"core definition of a site”.

• combination of files that are placed in the 12 hive of WFE

during installation of SharePoint.

• Site definition files include .xml, .aspx, .ascx, and .master

page files, as well as document template files (.dot, .htm,

and so on), and content files (.gif, .doc, and so on). 

17. Differences between site definition and site templates .

1. To create or use a site definition you need server admin access, but site template can install from web UI by site owners.

2. Site definition supports feature stapling, but for site template additional features must be activated in gallery.

3. Site definitions are stored on hard disk, but site templates are stored in content DB.

4. Site definition can provision multiple webs, but site templates are for single web only.

5. Creating site definition is relatively more complex than site template creation.

18 .Allow unsafe update VS run with elevated privileges

If code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property.

There are certain object model calls model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when request is initiated by a nonprivileged user. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.

Allow unsafe update is set to true when we are updating the content database to avoid external injections.

RWEP - It executes method with full rights even if the user does not otherwise have full control.

SPSecurity.RunWithElevatedPrivileges(delegate()

{     using (SPSite site = new SPSite(web.Site.ID))    

{     // implementation details omitted   

 } });

19 .What is LINQ Primer and how to  use  in SharePoint ?

LINQ or Language Integrated Query is a very useful language which reduces the complexity of accessing and integrating information that is not natively defined using OO technologies

Use of LINQ

Step 1: Add Microsoft.SharePoint.LINQ Reference

Step 2: Use the SPMETAL to generate the LINQ-to-SharePoint Data Context Class

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>spmetal.exe /web:http://sp2010vm/namespace:SandboxedSolution.ProjectDashboardSummary /code:SPProjectInitiation.cs

This will create the SPProjectInitiation.cs in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN and SPProjectInitiationDataContext as a Data Context. Please remember you have to regenerate this class every time you change the schema in the SharePoint Lists. 

Step 3: Add the LINQ-to-SharePoint Data Context Class (e.g. SPProjectInitiation.cs) in your Visual Studio Project

Step 4: Write the Queries against the SharePoint List

              SPProjectInitiationDataContext dc = new SPProjectInitiationDataContext(SPContext.Current.Site.Url);

                var query = from c in dc.BusITCapitalBudget

                            where c.Year.Equals(strYear)

                            select c;

 

                string strTargetCapitalBudget = "0";

                foreach (var c in query)

                {

                    strTargetCapitalBudget = c.TargetCapitalBudget == null ? "0" : c.TargetCapitalBudget.ToString();

                 } 

20 .What is SPMetal ?          

SPMetal is a command-line tool that generates entity classes and this classes are used in LINQ to SharePoint queries and also used to add, delete, and change list items with concurrency conflict resolution.

SPMetal.exe is presented in the below location:

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN


 

Thank you very much

          Fahadullah Karimi

         SharePoint Specialist


Previous SharePoint Interview Questions And AnswersNext SharePoint Interview Questions and Answers

No comments:

Post a Comment