SharePoint Interview Questions

What is SharePoint?

In simple terms, Microsoft SharePoint is web-based document management and collaboration platform that can be customized according to requirements.

As part of document management, you can create, edit, store documents in your SharePoint application and as part of collaboration you can share document within your workspace. You can also apply security policies on your documents to ensure it is shared to specific user groups only.

There’re many uses of SharePoint but on high level, SharePoint is used as a document management and Collaboration platform.

What is the difference between List and Library?

SharePoint List Document Library
Can have more than one documents attached to the list item Does not have document as an attachment instead it stores the document in library as an item
Only major version is supported  Major(Published) and minor(draft) versioning is supported
Do not support check-In/Check-Out feature Supports check-In/Check-Out feature
Documents added as attachment are not included in Search index/result Documents in library are included in search results
Attachment document in list item will not work with eDiscovery feature  Documents in library will work with eDiscovery feature
Cannot enable location based default value in list Can enable location based default value in document library
Cannot have document set Can have document set

What is the difference between Web Application, Site Collection and Site?

Web Application Site Collection Site(Sub Site)
Web Application is an IIS web site and it is on top position in SharePoint structure/hierarchy. Site Collection, as the name means, is a collection of one or more sites. A Site collection will at least have one top level site and optionally sub sites created under that site. Site is the component that contains the actual content like web parts, list, libraries, calendar, pages, etc...
While programming, SPWebApplication class represents Web Application.  While programming, SPSite class represents Site Collection. While programming, SPWeb class represents Site.
A Web Application can have multiple Content Databases 1) Per Site Collection, you can have maximum one Content Database.

Explanation: You can add multiple Content Databases in Web Application and while creating Site collection, use different Content Database in different Site Collection.

2) Multiple Site Collections can have one Content Database.

Explanation: You can have only one Content Database for Web Application and use the same while creating the Site Collections.
We cannot create separate Content Database for sub site. Content created in site goes to Site Collection Content Database only.

Below is the hierarchy of Web Application, Site Collection and Site.

Hierarchy:

  • WebApplication
    • Site Collection
      • Site (Sub Site)

What is the GAC?

Global Assemble Cache (GAC) is the location where you store your global assembly (.dll) file.

Location of GAC: C:\Windows\assembly

For version of .Net Framework (4.0 or above): C:\Windows\Microsoft.NET\assembly 

To open the GAC: 

  • Go to start >> Run
  • Write: c:\windows\assembly\gac_msil

SharePoint Application Deployment:
You can deploy your solution either in Bin Directory or in GAC

  1. Bin directory:
  • Bin directory is a folder located in a root directory of the web application.
  • This is partial trust location and has a low level of Code Access Security (CAS) permissions. You can use web.config file of your Web application to change the CAS policy
  • Bin directory is specific to web application that makes it possible to isolate code to particular web application.
  • You cannot have multiple versions of the same dll in Bin directory 
  1. GAC:
  • GAC is the place where signed assemblies are kept.
  • Assemblies kept in GAC run with full trust by default.
  • They are globally installed so can be utilized in any web application.
  • You can have multiple versions of the same dll in GAC if versioning is enabled. 

Note:  Every SharePoint Farm solution is automatically registered in GAC. I would recommend (as part of Best Practices) not to deploy dll in GAC unless it is needed (In cases like Timer Job, Custom Work flows or any other solution that needs “Global” access to the assembly).

What is Audience targeting?

Definition: Audience targeting is a feature which helps to display the content/data (e.g. list, library, web part, links, etc...) to only specific group or Audience.

1. Below are the options of Audience

  • SharePoint Group
  • Distribution Lists(Can be created using Admin centre and it is used to add group and add user in to the group)
  • Security Groups
  • Global Audience (This is set using Manage Audience option in Office o365 and SharePoint server )

2. You can enable Target Audience on below options

  • SharePoint List or Library
  • List items
  • WebPart
  • Navigation Link

What is the difference between BCS and BDC?

  • BDC - Business Data Catalog (Connectivity) was used in MOSS 2007. One can say BCS is extension of BDC.
    • BDC provides connectivity to the external data source.
    • Using BDC, you can perform Read operation on data.
  • BCS - Business Connectivity Services is used in SharePoint 2010, SharePoint 2013, and SharePoint 2019.
    • Using BCS, you can perform Create, Read, Update, Delete and Query(CRUDQ) operations on external data
  • Both BDC and BCS have built in support to provide connectivity to following kind of data sources.
    • Databases
    • Windows Communication Foundation (WCF) and Web services
    • Microsoft .NET Framework assemblies

What are the scopes of a feature?

Below are the scopes of a Feature. A Feature can be deployed at below mentioned levels

  • Farm Level:
    • The feature at this level can affect the entire farm.
    • The feature can be activated at farm level from Central Administration >> System Settings >> Manage Farm Features
  • Web Application Level:
    • The feature at this level can affect single Web Application only.
    • The feature can be activated at web application level from Central Administration >> Application Management >> Manage Web Applications >> Select a Web Application >> Click on Manage Features from Ribbon

  • Site Collection Level:
    • The feature at this level can affect entire site collection.
    • The feature can be activated at site collection level from Site Settings >> Site Collection Administration >> Site Collection Features

  • Site Level:
    • The feature at this level can affect only a single site.
    • The feature can be activated at site level from Site Settings >> Site Actions >> Manage Site Features

What is the difference between Farm solution and Sandboxed solutions?

Farm Solution Sandboxed solution
It is deployed on SharePoint server in solution store It is deployed on Site collection level in Solution gallery
Hosted in IIS worker process(W3WP.exe)  Hosted in SharePoint user code solution worker process(SPUCWorkerProcess.exe)
To debug, attach debugger to W3WP process, running the current site To debug, attach debugger to SPUCWorkerProcess process
IIS pool recycles when new feature/package is installed Not mandatory to recycle SPUCWorkerProcess process when new version of code is installed
The deployed code can affect the entire Farm The deployed code can only affect site collection
It supports all the features and functionalities as long as it is achievable using SharePoint server side object model or any other supported API. Do not support following features and functionalities

(1) Application pages
(2) Farm scoped features
(3) Web Application scoped features
(4) Workflow with code
(5) Cannot access resources from the server
Mapped folders can be added in the project Mapped folders cannot be added in the project
Can connect and access external database and web services Cannot access external database or connect to external web services
Farm solutions are installed >> deployed >> and features are activated for code to work Sandboxed solutions are uploaded to solution gallery >> and Activated for code to work
Only Farm Administrator can deploy the code package Need at least Site collection Administrator access to deploy the code package

What is Document Set?

Definition: Document set is a content type that can be used in a document library. You can keep collection of documents together as a single item and that is called a Document Set.

To enable document set in site collection, follow below mentioned steps.

  • Activate Document set feature at Site collection level
  • Go to a Document Library >> Enable Content Type
  • Now Click on “New Document” >> Document Set >> Specify New Document Set Name
  • Now you can add documents to this Document set.

Some points:

  • Welcome Page: Each document set comes with a welcome page which displays the document set metadata and files under the document set
  • Customize welcome page: You can modify the default page of the document set but the default page will be common to all the document sets in library. You cannot customize each document set welcome page differently.
  • Default Content: You can specify default content so that when you create new document set, the default content will automatically get created. E.g. if your company uses specific template for specific type of process, you can use predefined document template when you configure a Document Set Content Type.
  • Allowed Content Types: You can specify the content types, which can be used within Document set, when you configure a Document Set Content Type.
  • Workflows: (1) You can use standard Review and Approval workflow for the Document set, the entire Document set will get processed like a list item with the workflow steps. (2) You can also set workflow for individual document within Document set
  • Content Organizer: Document set can be used in Content Organizer for routing to different Site, Library or folder.
  • Version History: Version History can be captured of a document within Document Set

Why do we need to use AllowUnsafeUpdates?

If you want to update content database (Update Site, Web, List, Library etc..), as a result of GET request, then you will have to set AllowUnsafeUpdate property to true. Microsoft has kept this property to protect site from cross site scripting attack.


Some Points:
FormDigest is a hidden control in page which checks POST request (modification to content DB) and it throws error if the request is invalid (e.g. A GET request doing modification to content DB is an invalid request). To bypass this validation, we need to set AllowUnsafeUpdate property to true.
• If you are updating content database using POST request, then just use SPUtility.ValidateFormDigest() in your code. It will validate the request and after that AllowUnsafeUpdate value will be set true by default. So if you are using POST request, you don’t need to use AllowUnsafeUpdate property.
• If application is running in an HTTPContext (webpart, application pages, etc, ... ) and request type is GET, you will not be able to modify the content DB. By default AllowUnsafeUpdate property value is false for GET request. To update content DB in GET request, you have to set AllowUnsafeUpdate property value to true.
• If you are using console application, where HTTPContext object is not available (as it is not a web request), you do not need to set AllowUnsafeUpdate property to update content DB. Its value is always set to true.

© 2019 Code SharePoint