SharePoint Interview Questions and Answers
- Get link
- Other Apps
SharePoint Interview Questions and Answers
Q. Explain Below code
using (SPSite site = new SPSite(SPContext.Current.Web.Url)) // Gets the absolute url of the websiteusing (SPWeb web = site.RootWeb) // Gets the root website of site collection
using (SPWeb web = site.OpenWeb())// OpenWeb accepts either GUID of sites or site URL if a parameter is blank means returns the site associated with the current URL
SPWeb - Represents SharePoint service websites
SPSite - Represents a collection of sites in a web application.
SPWebApplication - Represents and IIS web application.
SPWebCollection - Represents a collection of SPWeb object.
SPWebTemplate - Represents a site definition or site template that is used to create SharePoint sites.
SPList - Represents a list on SharePoint Site.
SPListCollection - Represents a collection of SPList object.
SPListItem - Represents a list item or row.
SPListItemCollection - Represents a collection of SPListItem object
Base class for Timer Job - SPJobDefinition
Base class for Event Receiver - SPItemEventReceiver
You may visit Server Object Model (SOM) implementation in SharePoint 2013 here - http://www.sharepointcafe.net/2017/09/server-object-model-programming-sharepoint-2013.html
Q. Write basic code to interact with SharePoint List.
Server Object Model:using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb web = site.OpenWeb())
{
SPList list= web.Lists["MyList"];
SPListItemCollection items= list.GetItems();
web.AllowUnsafeUpdates = true;
foreach (SPListItem item in items)
{
item["Title"] = "New Title"; item.Update();
}
web.AllowUnsafeUpdates = false;
}
}
Client Object Model:
ClientContext context1 = new ClientContext(Constants.SITE_URL);
context1.AuthenticationMode = ClientAuthenticationMode.Anonymous;
List list1 = context1.Web.Lists.GetByTitle("ListName");
CamlQuery query1 = new CamlQuery();
query1.ViewXml = @"<Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where><OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy>";
Microsoft.SharePoint.Client.ListItemCollection listCollection1 = list1.GetItems(query1);
context1.Load(listCollection1);
context1.ExecuteQuery();
DataTable dTable1 = new DataTable();
dTable1.Columns.Add("Title");
for (int iCntr1 = 0; iCntr1 < listCollection1.Count; iCntr1++)
{
dTable1.Rows.Add(dTable1.NewRow());
if (listCollection1[iCntr1]["Title"] != null)
{
dTable1.Rows[dTable1.Rows.Count - 1]["Title"] = listCollection1[iCntr1]["Title"].ToString();
}
}
Q. What is CAML Query? How to write CAML Query?
CAML stands for Collaborative Application Markup Language. It is an XML based language that is used in SharePoint.CAML query generally used on SharePoint objects like List, Library, List Template, Content Type etc. To know more about SharePoint CAML Query and implementation, please click here.
Q. Page Parser Path in SharePoint
There is a limitation in SharePoint, script with runat server code not allowed in Application Pages.By adding below piece of code it can be done.
<PageParserPath VirtualPath="/myFiles/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true"/>
</PageParserPaths>
Now you may add below code to your page:
<script runat="server">
protected void Page_Load(Object sender, EventArgs e)
{
Response.Write("Server side code");
}
</script>
Q. Allow unsafe update vs run with elevated privileges
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
} });
Q. Safe Control in SharePoint
In SharePoint development environment a developer can add aspx file which may contain affect SharePoint environment, i.e. there might be a security risk.To reduce the risk SharePoint allows adding safe control tag in web.config file to avoid script injection
<SafeControls>
<SafeControl Assembly="[Assembly Name]" Namespace="[Namespace]" TypeName="*" Safe="True" />
</SafeControls>
Safe control contains assembly name, namespace name
Q. Timer Job in SharePoint
It is a job in SharePoint that runs in the background on a specified periodic basis.
public override void Execute(Guid targetInstanceId)
Execute is a override method which is responsible for executing timer job.
For more visit this link:
http://www.sharepointcafe.net/2015/06/timer-job-in-sharepoint-2010-how-to.html
Q.Throttling and Indexing in SharePoint
List in SharePoint is similar to SQL table, indexing on List improve the performance. A SharePoint list allows 20 indices. Not all column type can be indexed. Throttling is a process which set the limit of an item that will be accessed in a single request. The default limit is 5000.For more see this link
http://www.sharepointcafe.net/2015/07/throttling-and-indexing-in-sharepoint.html
SPList.EnableThrottling
for more visit this link:http://www.sharepointcafe.net/2015/07/throttling-and-indexing-in-sharepoint.html
Q. Create Child control in SharePoint
private const string _ascxPath = @"~/_CONTROLTEMPLATES/MyProject.WebParts/MyVisualWebPart1/MyVisualWebPart1UserControl.ascx";
protected override void CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
}
It does most of the rendering work related to a control such as a label control, textbox control etc.
LoadControl(usercontrolpath) is a method which loads web controls as per specified path.
Q. Web part properties using C# code
Below code is to set web part properties like width, chrome type, back color
protected override void CreateChildControls() {
Control control = Page.LoadControl(_ascxPath);
ChromeType = PartChromeType.None;
BackColor = Color.Red;
Title = "This is a test title";
this.ScrollBars = System.Web.UI.WebControls.ScrollBars.Both;
this.Width = 500;
Controls.Add(control);
}
Q. What is GAC?
GAC stands for Global Assembly CacheQ. Audience Targeting in SharePoint
It is a way to display list, library items to specific groups of people. Go to list or library setting ->General Settings -> Audience targeting settingsEnable Audio targeting and click on ok. Now go to list or library select any item, click on the arrow and select edit properties. You will now see an option for Audience Targeting.
Q. What is view in SharePoint?
A view is a way to choose what data you want to present over web page.There are:
Standard View
Calendar View
DataSheet View
Gantt View
Custom View (In SharePoint Designer)
Q. Create a different view for folder inside a document library
Q. Document Set in SharePoint
Provides the content types required for creating and using document sets. Create a document set when you want to manage multiple documents as a single work product.Q. ULS Log in SharePoint
ULS stands for Unified Logging ServiceULS helps a developer to find bugs without debugging an application.
try
{
//code
}
catch(Exception ex) {
SPDiagnosticsService spDiag = SPDiagnosticsService.Local;
spDiag.WriteTrace(0,new SPDiagnosticsCategory("My ULS Log", TraceSeverity.Monitorable, EventSeverity.Error), TraceSeverity.Monitorable, "ULS log error: {0}", new object[] { ex.Message }); }
ULS log viewer is a tool which presents log details in a readable format.
Q. SPSiteDataQuery in SharePoint
It is used to get data from multiple lists, and those lists could be on the same site or in multiple sites.CrossListQueryInfo is an another way to do this but internally it uses SPSiteDataQuery .
In SPSiteDataquery there are 2 scopes that can be defined.
<Webs Scope="Recursive" /> - Current website and all sub sites
<Webs Scope="SiteCollection" /> - All websites that are in current site collection
Q. Permission levels in SharePoint.
Full Control - Has Full control
Design - View, add, update, delete, approve
Contribute - view, add, update and delete items
Read - view pages and list items and download documents
Limited Access - Can view specific lists, document libraries, list items, folders or document on given permission
Site Pages stored in content database.
Application Pages support code behind.
Site Pages do not allow code behind.
SharePoint 2010 also have XSLT List view web part.
XSLT Listview web part - It is a web part that can be modified in SharePoint designer using XSLT code.
v4.master - Default team site master page.
default.master - This is the default master page for SharePoint 2007 look and feel.
minimal.master - Generally used by search centers.
simple.master - Used by SharePoint 2010 general pages like login page. error page, signout page etc.
Select your External Content Type Name and click on Set Object Permission from top ribbon.
Type account name, then Add and select operation that you want to allow for this user.
Refer Below Screen -
Farm - It affects all web application available in a farm.
Web Application- It affects a complete web application.
Site- It affects a single site collection.
Web - It affects a single site
There are 2 types of Events Before and After.
Generally known as Synchronous and Asynchronous events.
Event Receiver Base Class:
SPItemEventReceiver
SPListEventReceiver
SPEmailEventReceiver
SPWebEventReceiver
SPWorkflowEventReceiver
Event handler gets registered in Elements.xml file. It includes Class name, assembly name, List template id.
If any method removed/added in receiver class same will reflect in Elements.xml file.
SPItemEventProperties
properties.AfterProperties["Title"].ToString();
properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
properties.RedirectUrl = "_layouts/EventRcvrApp/Error.aspx?msg=Item+Cannpt+be+deleted";
So that's all for SharePoint 2010 interview questions and answers.
If you have more questions related to SharePoint 2010 interview, please put the same in the comment section.
You may like this -
Top 30 SharePoint 2013 Interview Questions and Answers for Developer
Web API Interview Questions and Answers
Design - View, add, update, delete, approve
Contribute - view, add, update and delete items
Read - view pages and list items and download documents
Limited Access - Can view specific lists, document libraries, list items, folders or document on given permission
Q. Application Pages vs Site Pages
Application Pages stored in hive folder.Site Pages stored in content database.
Application Pages support code behind.
Site Pages do not allow code behind.
Q. Data View Web Part
It is a way to display data with filtering. grouping. Data View web part was available in SharePoint 2007 and also available in 2010.SharePoint 2010 also have XSLT List view web part.
XSLT Listview web part - It is a web part that can be modified in SharePoint designer using XSLT code.
Q. ONET.xml file
It is the core of site definition. It is located under hive folder.Q. What are master pages available in SharePoint?
You can get more interview questions related to SharePoint master page.v4.master - Default team site master page.
default.master - This is the default master page for SharePoint 2007 look and feel.
minimal.master - Generally used by search centers.
simple.master - Used by SharePoint 2010 general pages like login page. error page, signout page etc.
Q. What is a Term?
A term is a keyword or phrase that can be associated with an item. A term set is a collection of related terms.Q. Access Denied by Business Data Connectivity - Error in External List
Go to Central Admin-> Manage Service Application -> Click on Business connectivity service->Select your External Content Type Name and click on Set Object Permission from top ribbon.
Type account name, then Add and select operation that you want to allow for this user.
Refer Below Screen -
Q. Feature and Scope of feature available in SharePoint:
A feature is a set of code or functionality that can be activated or de-activated at various level to perform some change in SharePoint site.Farm - It affects all web application available in a farm.
Web Application- It affects a complete web application.
Site- It affects a single site collection.
Web - It affects a single site
Q. Event Receiver
Event Handler and ReceiverThere are 2 types of Events Before and After.
Generally known as Synchronous and Asynchronous events.
Event Receiver Base Class:
SPItemEventReceiver
SPListEventReceiver
SPEmailEventReceiver
SPWebEventReceiver
SPWorkflowEventReceiver
Event handler gets registered in Elements.xml file. It includes Class name, assembly name, List template id.
If any method removed/added in receiver class same will reflect in Elements.xml file.
SPItemEventProperties
properties.AfterProperties["Title"].ToString();
properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
properties.RedirectUrl = "_layouts/EventRcvrApp/Error.aspx?msg=Item+Cannpt+be+deleted";
Q. Application Page vs Site Page vs Custom ASPX Page
The most asked questions in SharePoint interview.
Application Page
|
Site Page
|
Custom Page
|
Support Code behind
|
Do not support code behind
|
Can have code behind, but code-behind file will not be deployed
|
They inherit from application.master
|
They inherit custom look of the site
|
Need to specify the URL of the custom master page
|
Stored in layout folder available in hive folder
|
Stored in content database
|
Deployed in layout folder
|
So that's all for SharePoint 2010 interview questions and answers.
If you have more questions related to SharePoint 2010 interview, please put the same in the comment section.
You may like this -
Top 30 SharePoint 2013 Interview Questions and Answers for Developer
Web API Interview Questions and Answers
You may read some popular blogs on SharePointCafe.Net |
- Get link
- Other Apps
Popular
Top 30 ASP.Net Web API Interview Questions and Answers
CAML Query Tutorial for SharePoint 2013 and 2010 - A Complete tutorial guide
CAML Query is one of the most important topics in SharePoint. CAML Query is the way for querying items from SharePoint objects like List and Library. This blog is helpful in SharePoint 2010 development as well as in SharePoint 2013 development.
What is MicroService? A modern approach to develop software applications
Before describing MicroServices we should first understand distributed technologies we already have in the industry. Prior to MicroServices, we have already Web Services, WCF Service and latest one from Microsoft i.e. ASP.Net Web API. Then Why MicroService Architecture?
You may read about all these distributed technologies in details in my earlier blog.
You may read about all these distributed technologies in details in my earlier blog.
How to consume RESTful APi from server side code - C#
What's new in C# 6.0 language?
Introduction to ASP.NET Core - Basic Introduction with Visual Studio 2015 and 2017
All about SharePoint 2010 Content Type Hub - SharePoint 2010 Tutorial
ASP.Net Web API Security
If you are new to ASP.Net Web API then please start from the beginning level. What is ASP.Net Web API? In the previous blog, I wrote about Routing in Web API. You may also like .Net Core Introduction and MicroService Architecture.
I have also explained, How to create a secure Web API? in my earlier blog.
In this blog, let's discuss the Web API security in details.
I have also explained, How to create a secure Web API? in my earlier blog.
In this blog, let's discuss the Web API security in details.
Getting started with Microsoft Azure
If you are new to Microsoft Azure, then please read my earlier blog on Cloud Computing and Microsoft Azure introduction.
In this blog, I will explain how to create resources in Azure Dashboard and will show you screenshots. This will be a totally new experience for me as well because I am also new to Cloud Computing and wanted to share my experience through my blog.
In this blog, I will explain how to create resources in Azure Dashboard and will show you screenshots. This will be a totally new experience for me as well because I am also new to Cloud Computing and wanted to share my experience through my blog.
Tags
Tags
cloud-computing12
sharepoint-201310
interview8
sql8
webservice7
angularjs6
entity-framework6
design-pattern5
linq5
sharepoint-programming5
powershell4
socialmedia4
caml3
dot-net-core3
rest3
workflow3
ajax2
aws2
html2
infopath2
javascript2
oops2
searchservice2
sharepoint-interview2
soa2
timer job2
website2
3tier1
active-directory1
caching1
devops1
fba1
imageupload1
json1
list1
managed-metadata-service1
metadata1
odata1
page-layout1
performance1
run with elevated1
safecontrol1
security1
sharepoint interview questions1
sharepoint security1
sharepoint-architecture1
sharepoint-branding1
sharepoint-migration1
sharepoint-service1
sharepoint-topics1
sharepointlist1
site-definition1
soap1
uls1
validation1
viewstate1
xml1
Show more
Show less
Comments
Post a Comment
Dear Readers, Please post your valuable feedback in the comment section if you like this blog or if you have any suggestions. I would love to hear the same from you. Thanks