Friday, June 13, 2014

SharePoint Interview Questions

 


Microsoft has replaced the "12 hive" structure that we had in SharePoint 2007 with "14 Hive" structure in 2010.

It has apparently added four new folders to its hive.

The Folders are :
* Policy
* UserCode
* WebClients
* WebServices

See the Details at : 14 hive Directory structure

In Sharepoint 2010 This is a step-by-step tutorial to learn using sharepoint 2010's Server and client object model.
Server Object Model –

Here we will look at how to use SharePoint API’s, LINQ, REST and SharePoint web service to extract data from sharepoint server.

Lets Start with using the API’s in Microsoft.SharePoint and Microsoft.SharePoint.Utilities namespaces.

Firstly, to work with SharePoint 2010 components, your code must first establish the site context or site collection context for requests that are made to the server.

Please Note : In SharePoint, the SPsite object also refered to as Site is actually a “Site Collection” object, not a website
and the SPweb object also refered to as “web” is a single site in the site collection.(It can be a top-level site collection site).
also, object of type SPWebApplication is a big boss object which has reference to the web applictaion that contains the site collection.

To get the reference to site context in your code use the recommended Microsoft.SharePoint.SPContext class and its members.

Lets look at how it is used

To get a reference to the site collection -

SPSite oSiteCollection = SPContext.Current.Site;

To get a reference to the current web site or web in the site collection -

SPWeb oWebSite = SPContext.Current.Web;

or

SPWeb oWebSite = SPControl.GetContextWeb(Context);

Note : if your are using Microsoft.SharePoint.SPContext class, you should not dispose any SPSite or SPWeb object obtained
by any of the above methods. The SharePoint Foundation runtime will dispose of them after page completion.

To get a reference to all the webs or sites in a site collection -

SPWeb oWebSite = SPContext.Current.Site.AllWebs["mySite1"];

oWebSite.Dispose();

Note : You should explicitly dispose of references to objects that are obtained through the AllWebs() or Openweb() property. You can also use using clause
like below to avoid calling the dispose off method and let sharepoint do this for you.

using can be something like

using (SPWeb oWebSite = SPContext.Current.Site.AllWebs["mySite1"]);
{

}

You can also use the Openweb() as below

using (SPWeb oWebSite = mySiteCollection.OpenWeb(“mySite1?))
{

}

Lets look at some other components of the SharePoint farm that you can get using SPContext

To get a reference to the current top-level server farm object -

SPFarm myFarm = SPContext.Current.Site.WebApplication.Farm;

To get a reference to the site collection database -

SPSite oSiteCollection = SPContext.Current.Site.CurrentDatabase

Lets look at some of the general code snippets

To return the collection of site collections in a SharePoint Web application -

SPWebApplication webApplication = SPContext.Current.Site.WebApplication;

using (SPSiteCollection siteCollections = webApplication.Sites)
{

foreach (SPSite siteCollection in siteCollections)
{
Label1.Text += siteCollection.Url + “
”;

siteCollection.Close();
}

}

Note : To runthe above code reference the Microsoft.SharePoint.Administration.SPWebApplication assembly in your code.

To return the collection of The all the Webs or sites within a site collection, including the top-level site and all subsites.

SPSite oSiteCollection = SPContext.Current.Site;
using(SPWebCollection collWebsite = oSiteCollection.AllWebs);
{

for (int i = 0; i < collWebsite.Count; i++)
{
using (SPWeb oWebsite = collWebsite[i])
{
SPListCollection collList = oWebsite.Lists;

for (int j = 0; j < collList.Count; j++)
{
Label1.Text += SPEncode.HtmlEncode(collWebsite[i].Title) + ” ”
+ SPEncode.HtmlEncode(collList[j].Title) + “
”;
}
}}}

To return the all the subsites and lists of the current site

using (SPWeb oWebSite = mySiteCollection.OpenWeb())
{

using(SPWebCollection subSites = oWebsite.Webs)
{

foreach (SPWeb subSite in subSites)
{
Label1.Text += SPEncode.HtmlEncode(subSite.Title) + “
”;

SPListCollection collList = subSite.Lists;

foreach (SPList oList in collList)
{
Label1.Text += SPEncode.HtmlEncode(oList.Title) + ” ” +
oList.ItemCount.ToString() + “
”;

}subSite.Close();
}
}}


Q. What is 14 hive in SharePoint?

Ans. See SharePoint 2010 Object Model

Q. How would you re-deploy the old custom solutions in SharePoint 2010.What Changes are needed to the old Solution files.

Ans. SharePoint 2010 object model contains many changes and enhancements, but our custom code will still compile and, will run as expected. You should however, rewrite and recompile any code that refers to files and resources in "12 hive".
For Details See :
See SharePoint 2010 Object Model - Backward Compatibility

Q. How many types of Client Object model extension are available in 2010 and when would you use one or the other.

Ans. To develop rich client side solutions, three set of client-side APIs has been introduced in the Microsoft.SharePoint.Client namespace. The three APIs are targeted for three different types of clients.
1. .net Managed applications – These are used when we have to create console applications or window applications, web applications which are not running inside SharePoint Contex.
2. For Silverlight applications
3. ECMAScript – It is a client object model extension for using with JavaScript or JScript. This is used for creating applications which are hosted inside SharePoint. For example, web part deployed in SharePoint site can use this JavaScript API for accessing SharePoint from browser using JavaScript.

Q. What are the security improvements in SharePoint 2010 ?

Ans. In SharePoint 2010 a variety of security methods have been introduced.

Claims-Based Authentication - Claims based authentication is based on identity. and trust.

Code Access Security - in which you can specify your own code access
security (CAS) policy for your web parts.

Sandbox Solutions - Sandbox Solutions which when deployed to the server, SharePoint runs in a special process that has limited permissions.

Cross-Site Scripting - Introduced to prevent Cross - Site Scripting (XSS) attacks.


Q. Whats New with SharePoint WebParts?

A developer can create two types of webparts using Visual Studio 2010.

1. Visual Webparts - Allows you to Drag and Drop the controls from the Toolbox to WebPart Design surface. You can of course write your custom code in the code file. You can also package and deploy your webparts directly to Sharepoint from VS by pressing Clt+F5. Visual studio 2010 also provides you with three different views for developing webparts. The views are split view, design view and Source view(as we have in designer 2007).

Note : The Visual Webpart project Item basically loads a User Control as a WebPart.


2. ASP.Net WebParts - Where a developer can build up User Interface and logic in a class file. You do not have designer for drag and drop of controls. This webpart inherits from standard ASP.Net webpart. For Deployment we can again use ctrl+f5 to deploy this webpart.


Q. What are the Visual Studio 2010 Tools for SharePoint.

Ans. Visual Studio 2010 includes SharePoint-specific project types and project item types, and includes powerful packaging, deployment, and debugging features that help increase your efficiency as a SharePoint 2010 developer.

Some of the Templates avaiable are :
1.Visual Web Part project template.
2. List defination template.
3. Content Type template.
4. Empty Project template.
5. Event Receiver template.
6. some workflow template.
7. the Site Definition template
and many more....


Q. What are SharePoint Sandboxed soultions ?

Ans. SharePoint 2010 provides a new sandboxed environment that enables you to run user solutions without affecting the rest of the SharePoint farm. This environment means that users can upload their own custom solutions without requiring intervention from administrators, and without putting the rest of the farm at risk. This means that the existing sites\pages or components will not be effected by the newly added soultion.

Users can deploy the below four things as sandboxed soultions :
1. WebParts.
2. Event Receivers.
3. List Definations.
4. Workflows.


Q. What are Requirenments for SharePoint 2010.

Ans. SharePoint Server 2010 will support only 64 - bit. It will require 64 bit Windows Server 2008 or 64 bit Windows Server 2008 R2. In addition to this, it will require 64 bit version of SQL Server 2008 or 64-bit version of SQL Server 2005.


Q. What is LINQ. How is it used in Sharepoint ?

Ans. LINQ is a feature of the programming languages C# 3.0 and Visual Basic .NET. LINQ allows you to query in an object-oriented way, supports compile-time check, gives you intellisense support in Visual Studio and defines a unified, SQL like syntax to query any data source. But unlike other languages and query syntaxes which vary from one type of data source to another, LINQ can be used to query, in principle, any data source whatsoever. It is commonly used to query objects collections, XML and SQL server data sources.

The LINQ to SharePoint Provider is defined in the Microsoft.SharePoint.Linq namespace. It translates LINQ queries into Collaborative Application Markup Language (CAML) queries.

Q. What Changes are made in SharePoint 2010 to enforce Referential Integrity?

Ans. In SharePoint 2010, Referential Integrity is enforced using two options, available with Look-up columns.

While creating a Look-up column, you can either choose a) Restrict Delete or b) Cascade Delete to define a relationship between the Look-up list and the list containing the look-up Column. Read Details at SharePoint 2010 Referential integrity - Using LookUp Column


Q. Whats Ribbon in SharePoint 2010?

Ans. See the Post Ribbon in SharePoint 2010


Q . Whats New in SPALerts ?

Ans. In SharePoint 2007, alerts were send only through e-mails, but in SP2010 users can also send an alert to mobile devices as SMS Message. A New property DeliveryChannels is introduced to indicate, whether the alert is delivered as E-mail or as an SMS Message.



Q. What Has Changed with SSP in SharePoint 2010.

Ans. In SharePoint 2010 Shared Service Providers (SSP's) are replaced by Service Applications. Services are no longer combined into a SSP. They are running independent as a service application. The service application architecture is now also built into Microsoft SharePoint Foundation 2010, in contrast to the Shared Services Provider (SSP) architecture that was only part of Office SharePoint Server 2007.

A key benefit here is that all services are installed by default and there is no SSP setup.


Q. What is a Delegate control?
Ans. A Delegate Control is a good a way to override the existing controls\components in Out-of-Box SharePoint. SharePoint specify some important components like search box, SharePoint Page header, GlobalNavigation etc as Delegate controls. These Delegate controls are based on numbered sequences which can be overridden while specifying your own control. So for example you want to add a new search control on your SharePoint site, you can override tag in your elements.xml with sequence number greater than the original search input box.

Q. What is the difference when using Using() Vs Dispose() Vs Try / finally while developing SharePoint Components.
Ans. By "Using" you can automatically dispose of SharePoint objects. You use try - catch and finally blocks when you need to handle exceptions.

Q. How would you know the Potential memory leaks?
Ans. You can check in Log files or can use the SharePoint Dispose Checker Tool.

Q. Do you about User Information List in SharePoint?
Ans. This is a Hidden List in SharePoint accessible by Site/_catalogs/users/simple.aspx.You can query this list with User ID for user's Name, Picture Url etc.

Q. What is the difference between targeting Audience Vs SharePoint Group.
Ans. With Audience group you can set rules but with SharePoint groups you can just target with the whole list.

Q. How do add Jquery or JavaScript in your SharePoint Site?
Ans. You can use Delegate Control "AdditionalPageHead" to add JavaScript or Jquery to all SharePoint Pages.
example,
AllowMultipleControls="true"/>

Q. How do you Change the Datasource for Global and Quick Launch Navigation?
Ans. You can Change the DataSourceID for the Global and QuickLaunch navigation with a custom Navigation source.

Q. How do you Override the Navigation For example Quick Launch with your Own control.
Ans. In SharePoint, you can override Navigation Providers with your own Custom Providers.

Q. Can you add left navigation in your Custom aspx page which you deployed in SharePoint?
Ans. Yes, You need to add the master Page tags in your custom aspx page and add the content of aspx page in MainContent area.

Q. What are the Hardware and Software requirements for SharePoint 2010.

Ans.

Hardware requirements :

# Processor 64-bit, four-core, 2.5 GHz minimum per core.

# RAM 4 GB for developer or evaluation use, 8 GB for single server and multiple server farm installation for production use.

# Hard disk 80 GB for installation

For production use, you need additional free disk space for day-to-day operations. Add twice as much free space as you have RAM for production environments.


Software requirements :

# The 64-bit edition of Windows Server 2008 Standard with SP2. If you are running Windows Server 2008 without SP2, the Microsoft SharePoint Products and Technologies 2010 Preparation Tool installs Windows Server 2008 SP2 automatically.

For more see : Prerequisites for SharePoint 2010


Q. What Has Changed with SSP in SharePoint 2010.

Ans. In SharePoint 2010 Shared Service Providers (SSP's) are replaced by Service Applications. Services are no longer combined into a SSP. They are running independent as a service application. The service application architecture is now also built into Microsoft SharePoint Foundation 2010, in contrast to the Shared Services Provider (SSP) architecture that was only part of Office SharePoint Server 2007.

A key benefit here is that all services are installed by default and there is no SSP setup.

Additional improvements for the service application model include:

• The services architecture is extensible, allowing third-party companies to build and add services to the platform.

• Services are managed directly in Central Administration (rather than a separate administration site).

• Services can be monitored and managed remotely.

• Services can be managed and scripted by Windows PowerShell™.

• Shared services communications take place over HTTP(S). Shared services do not directly access databases across farms.

• Most new services are built on the Windows Communications Framework. They have optimization built into their protocol, using binary streams instead of XML for data transfer. Test results show improvements in network throughput with this change.


Q. What are the advantages of Service Applications over
SSP ?

Ans. The key limitation of the SSP architecture was that it was configured by using a set of services, and all Web applications associated with the SSP bore the overhead of all the services even if they weren’t being used. To change the service configuration for a particular Web application, a new SSP would have to be created.

The service application architecture on the other hand, allows a set of services to be associated with a given Web application and a different set of services to be associated with another Web application. Also, the same service application can be configured differently in different Web applications; therefore, Web sites can be configured to use only the services that are needed, rather than the entire bank of services.


Q. Can we create a Single set of Services that will be shared across the farm?

Ans. Similar to the SSP model in Office SharePoint Server 2007, a single set of services can be shared by all sites in a farm. By publishing a service application (from the sharing group, under Service application tab), you can share it across server farms. This capability does not apply to all service applications, and some services can be shared only within a single server farm.


Q. What are Managed Accounts?

Ans. To reduce the load of managing various service accounts in Microsoft SharePoint Server 2010, the concept of managed accounts has been introduced. Much like managed accounts in Windows Server 2008, they allow SharePoint Server to take control of all the service accounts you use. After SharePoint Server has control of these accounts, it can either manage their passwords — automatically changing them as necessary — or it can notify you when an accounts password is about to expire, allowing you to make the change yourself.


Q. What are the Methods of Backup and Recovery in SharePoint 2010?

Ans. Microsoft SharePoint Server 2010 provides a broad range of levels for performing backups, including the entire farm, farm configuration information, site collections, subsites, or lists.

SharePoint Server 2010 uses two different tools to configure backup and recovery.

1. Central Administration : Central Administration provides a user interface where SharePoint Administrators will be prompted via menu structures to select the information that needs to be backed up. (see the Image below)


2. Windows PowerShell : Windows PowerShell is a command line tool that provides SharePoint administrators a way to perform backup and recovery with additional options such as file compression or working with SQL snapshots.

Listed below are a few of the benefits available when working with Windows PowerShell:

• Windows PowerShell scripts can be developed and scheduled (with Windows Task Scheduler), whereas Central Administration is used for single-use backups and restores.

• Windows PowerShell has the advantage of running against SQL snapshots instead of the production database. One of the parameters of the Windows PowerShell command will cause a SQL snapshot to be generated, and then Windows PowerShell will run the action against the snapshot instead of the production database. This will reduce the resource impact of the backup operation on the production environment.

• With Windows PowerShell, SharePoint administrators will have more granular control of options for the backup or restore.

For more info See : Windows PowerShell Tutorial



Q. How to Move content Databases using PowerShell ?

Ans. To attach\detach an existing content database use

Mount-SPContentDatabase "" –DatabaseServer "" –WebApplication http://WebapplicationName

is the content database to be attached.

is the name of the database server.

http://WebapplicationName is the name of the Web application to which the content database is being attached.

To detach a content database:

Dismount-SPContentDatabase ""

See more Commands at Windows Powershell Common Commands


Q. How to Export a Site or List in SharePoint 2010?

Ans. SharePoint Server 2010 provides several new features that provide a granular level of backup for various components of site content. This includes content at the site, subsite, and list level.

Through Central Administration(Granular level Back-up) a SharePoint Administrator can configure a backup of a subsite or list. An Administrator can choose a site and a specific list to be exported.The administrators can also choose to export security and select the different versions that will be exported with the list.

Q. What has Changed in SharePoint 2010 Object model?

Ans. Microsoft has replaced the "12 hive" structure that we had in SharePoint 2007 with "14 Hive" structure in 2010.

It has apparently added three new folders to its hive.

The Folders are :

* UserCode – files used to support sandboxed solutions
* WebClients – used for the client Object Model
* WebServices – New .svc files


Q. How would you deploy WebPart Using Windows PowerShell?

Ans. At the Windows PowerShell command prompt (PS C:\>), type the below command :
Install -SPWebPartPack -LiteralPath "FullPathofCabFile" -Name "Nameof WebPart"


Q. How would you re-deploy the old custom solutions in SharePoint 2010.What Changes are needed to the old Solution files.

Ans. SharePoint 2010 object model contains many changes and enhancements, but our custom code will still compile and, will run as expected. You should however, rewrite and recompile any code that refers to files and resources in "12 hive".
For Details See :
SharePoint Object Model – Backward Compatibility


Q. How would you add a link in the Ribbon?

Ans. You can add any link or Custom Action under any of the existing tabs of the ribbon or can create a new a new tab and place your links under it.


Q. What does CMDUI.XML contain?

Ans. The definitions for the out-of-the-box ribbon elements are split across several files in the SharePoint root, with TEMPLATE\GLOBAL\XML\CMDUI.XML being the main one.


Q. What are the Disadvantages of Using LINQ in your Code?

Ans. LINQ translates the LINQ queries into Collaborative Application Markup Language (CAML) queries thus adding an extra step for retrieving the items.


Q. What is different with SharePoint 2010 workflows ?

Ans. Some of the additions in workflow model are :

1. SharePoint 2010 workflows are build upon the the workflow engine provide .Net Framework 3.5.

2. In addition to the SharePoint lists we can now create workflows for SharePoint sites as well.

3. SharePoint Designer 2010 also has a new graphical workflow designer for designing workflows and deploying them directly to SharePoint.

4. Another Improvement in SharePoint Designer 2010 is that it now allows you to edit the out-of-the-box workflows that come with SharePoint.

1. SharePoint 2010 workflows are build upon the workflow engine provided .Net Framework 3.5.

2. List and Site workflows - In addition to the SharePoint lists we can now create workflows for SharePoint sites as well. These are called as "Site Workflows".

3. SharePoint Designer 2010 Changes - MS has provided a new graphical workflow designer for designing workflows. These workflows can be deployed in SharePoint Server directly from the designer.

4. Editing Out-of-Box workflows - Another Improvement in SharePoint Designer 2010 workflows is that it now allows you to edit the out-of-the-box workflows that come with SharePoint.

5. Re-usable Workflow - In addition to above, with Designer 2010 you can also create reusable declarative workflows. That means unlike SharePoint 2007 designer workflows, you don't have to bind a workflow to a specific list. You can resuse them by binding it to more than one list or multiple lists.

6. User profile in Workflow - User Profile data can now be bound to properties in workflow. This will make it possible to get information about the SharePoint user profile in the workflow itself.

7. Moving SharePoint Designer Workflows - The resuable designer workflows can now be moved to another SharePoint server or to Visual Studio 2010 with a workflow .wsp file. "Save as Template" command can be used to create the WSP file for the workflow.

8.Changes in List Events - SharePoint 2010 adds four new workflow Event Receivers for list based workflows. The four workflow event receivers available are Starting, Started, Postponed and Completed. These are similar to other SharePoint list\library event receivers and they execute code on the server in response to the event.

9. Workflow Templates - To make development easier, Visual Studio 2010 includes event receiver project types to make using the workflows and events fairly simple.

Now to Start developing workflows what do you need.

1. SharePoint designer - If you need to customize the Out-of-box workflow or wants to create a "not so complex" reusable workflow. You can however, deploy your designer workflow in any sharepoint enviornment using a wsp file. See Move Designer workflow using wsp

2. Microsoft Visio - If you want to design a workflow which has complex workflow chart, you can design it in Viso and later it can be pulled in to SharePoint designer. Also, note that you can only create Sequential workflows in viso.

3. Creating Worflow in VS - Visual Studio 2010 provides templates to create workflows and creates events for the workflow.

Lets look at some of the Videos available for creating workflows using all above methods.


Q. What Do you know about SharePoint Object Model?

Ans. In Sharepoint Object model there are two Important namespaces.

The Microsoft.Office.Server namespace is the root namespace of all Office Server objects and Microsoft.SharePoint is the root namespace for all WSS objects.
Read More at SharePoint 2007 Object Model


Q. Can you develop webparts and other SharePoint solutions at your local machine?

Ans. In order to run and debug sharePoint solutions, the project must reside on the server which has Windows sharePoint services installed. However, you can reference the Microsoft.SharePoint dll in your project at your local, but you won’t be able to run it.


Q. How do you debug SharePoint Webparts?

Ans. To debug SharePoint webpart (or any solution) you can simply drag and drop your complied .dll in GAC and recycle the app pool. You can also run upgrade solution command from stsadm.


Q. How would you retrieve large number of Items form the list ?

Ans. To retrieve large number of items with a better performance we can either use SPQuery or PortalSiteMapProvider Class. Read More with Examples
Retrieving large number of Items from sharepoint list


Q. How Do you implement Impersonation in ShrePoint.

Ans. By Using RunWithElevatedPrivileges method provided by SPSecurity class.
See e.g Impersonation in Sharepoint


Q: What is the performance impact of RunWithElevatedPrivileges?

Ans. RunWithElevatedPrivileges creates a new thread with the App Pool's credentials, blocking your current thread until it finishes.


Q. How will you add Code behind to a Custom Applictaion Page or a Layout Page in SharePoint?

Ans. You do not deploy a code behind file with your custom Layouts page. Instead, you can have the page inherit from the complied dll of the solution to access the code behind.


Q. What is the difference between a Site Definition and a Site Template?

Ans. Site Definitions are stored on the hard drive of the SharePoint front end servers. They are used by the SharePoint application to generate the sites users can create. Site Templates are created by users as a copy of a site they have configured and modified so that they do not have to recreate lists, libraries, views and columns every time they need a new instance of a site.


Q. Why do you use Feature Receivers ?

Ans. Feature Receivers are used to execute any code on Activation\Deactivation of a Feature. You can use it for various purposes.


Q. Can you give a example where feature receivers are used.

Ans. You can use it to assign an event receiver feature to a specific type of list or can write a code in a feature receivers Deactivate method to remove a webpart from webpart gallery.


Q. Where do you deploy the additional files used in your webpart, like css or javascript files, and how do you use them in your WebPart?

Ans. You can deploy the css or javascript files in _layouts folder in SharePoint's 12 hive. To use them in your webpart, you need to first register them to your webpart page and then specify a virtual path for the file for e.g. _layouts\MyCSS.css See Code examples at Using External Javascript, CSS or Image File in a WebPart.


Q: When should you dispose SPWeb and SPSite objects?

Ans. According to the best Practices you should always dispose them if you have created them in your code. You can dispose them in Finally block or you can use the "Using" clause, so that they gets disposed when not required. If you are using SPContext then you need not dispose the spsite or spweb objects.


Q. What are the best practices for SharePoint development.

Ans. Some of the best practices are:

1. You should always dispose SPsite and SPWeb objects, once you refer them in your code. Using the "Using" clause is recommended.

2. Use RunwithelevatePrivilages to avoid errors for end users.

3. Try writing your errors to SharePoint error logs (ULS Logs). Since it’s a bad idea to fill-up event log for your production environment.

4. Use SPQuery instead of foreach loop while retrieving Items from the list.

5. Deploy additional files used in your webpart to 12 hive. Use your solution package to drop the files in 12 hive. Also, make sure that all the references (for e.g. Css or .js files) get removed when the solution is retracted.
Also See : Best Practices to Improve Site Performance


Q.What is the main difference between using SPListItem.Update() and SPListItem.SystemUpdate()?

Ans. Using SystemUpdate() will not create a new version and will also retain timestamps.

Q. When do you use SPSiteDataQuery ?

Ans. You can use SPSiteDataQuery when you need to extract data from more than one list\library in your site colletcion. The data is extracted on the basis of the query you write and is
returened as a Datatable. You can also specify the GUID for the lists\libraries you want to query against.

Q. How do you create a Custom action for an item in a list ?

Ans. This can be done by adding a new feature into SharePoint. You would need to use customaction tag in your elements.xml file and will have to set various properties like imageurl or UrlAction for your customaction. You can later add this feature into sharepoint using stsadm install feature command.

Q. How would you bind this CustomAction to a specific list ?

Ans. To do this you can either create a new list type(again a feature) and use the listtype number for the new list in your RegistrationType property of the Customaction. The CustomAction will then show up only for the items of this list type. or You can create a new content type and then use that content type's id in your cutsomaction to bind the custom action to items of just that content type. Add the new content type to the list where you need this customaction.


Q. How will you deploy an existing asp.net webapplication or website in SharePoint?

Ans. You would need to wrap the web application in a solution package in order to deploy it in 12 hive or say ShraePoint. It is recommended to create a feature first, and then wrap everything in a Solution package. See example Depoly a Custom aspx Page in SharePoint


Q. How will you cancel a deployment from central admin -> solution managment, if its stuck at “deploying” or “Error”.

Ans. You can either try to force execute timer jobs using execadmsvcjobs command or can cancel the dpeloyment using stsadm command stsadm –o cancaldeployment –id {GUID} command. The Id here would be GUID of the timer or deployment job. You can get the Id from stsadm enumdeployment command. This will display all the deployments which are process or are stuck with Error.


Q. How do make an existing non-publishing site Publishing?

Ans. You can simply activate the SharePoint Publishing Feature for the Site, you want to make publishing.


Q. Can you name some of the tools used for SharePoint Administration?

Ans. Tools Used for SharePoint Administration


Q. What are Application Pages in SharePoint?

Ans. Unlike site pages (for example, default.aspx), a custom application page is deployed once per Web server and cannot be customized on a site-by-site basis. Application pages are based in the virtual _layouts directory. In addition, they are compiled into a single assembly DLL.
A good example of an Application Page is the default Site Settings page: every site has one, and it's not customizable on a per site basis (although the contents can be different for sites).
With application pages, you can also add inline code. With site pages, you cannot add inline code.


Q. What is Authentication and Authorization?

Ans . An authentication system is how you identify yourself to the computer. The goal behind an authentication system is to verify that the user is actually who they say they are.
Once the system knows who the user is through authentication, authorization is how the system decides what the user can do.


Q. How do you deploy a User Control in SharePoint ?

Ans. You deploy your User Control either by a Custom webpart, which will simply load the control on the page or can use tools like SmartPart, which is again a webpart to load user control on the page. User Control can be deployed using a custom solution package for the webapplication or you can also the control in the webpart solution package so that it gets deployed in _controlstemplate folder.


Q. Which is faster a WebPart or a User Control?

Ans. A WebPart renders faster than a User Control. A User Control in SharePoint is usually loaded by a webpart which adds an overhead. User Controls however, gives you an Interface to add controls and styles.


Q. What SharePoint Databases are Created during the standard Install?

Ans. During standard install, the following databases are created :

SharePoint_AdminContent
SharePoint_Config
WWS_Search_SERVERNAME%_%GUID_3%
SharedServicesContent_%GUID_4%
SharedServices1_DB_%GUID_5%
SharedServices1_Search_DB_%
GUID_6%WSS_Content_%GUID_7%


Q. What are content types?

Ans. A content type is a flexible and reusable WSS type definition (or we can a template) that defines the columns and behavior for an item in a list or a document in a document library. For example, you can create a content type for a leave approval document with a unique set of columns, an event handler, and its own document template and attach it with a document library/libraries.


Q. Can a content type have receivers associated with it?

Ans. Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.


Q. Can you add a Cutsom Http Handler in SharePoint ?

Ans. Yes, a Custom httphandler can be deployed in _layouts folder in SharePoint. Also, we need to be register the handler in the webapp's webconfig file.


Q. While creating a Web part, which is the ideal location to Initialize my new controls?
Override the CreateChildControls method to include your new controls. You can control the exact rendering of your controls by calling the .Render method in the web parts Render method.


Q. How do you return SharePoint List items using SharePoint web services?
Ans.
In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.


Q. How Do you deploy Files in 12 hive when using wspbuilder or vsewss?

Ans. Typically, you can add these files in the 12 hive folder structure in your project. In Vsewss however, you will have to create this structure manually.

Q. What files gets created on a file system, when a Site collection is created ?

Ans. Windows SharePoint Services does not create any files or folders on the file system when the site collection or sites are created; everything is created in the content database. The Pages for the site collection are created as instances in the content database. These instances refer to the actual file on the file system.


Q. What are Customized and Uncustomized Files in SharePoint ?

Ans. There are two types of Pages in SharePoint; site pages (also known as content pages) and application pages.

Uncustomized :

When you create a new SharePoint site in a site collection, Windows SharePoint Services provisions instances of files into the content database that resides on the file system. That means if you create a new Site "xyz" of type Team Site(or Team sIte Definition), an instance of the Team Site Definition( Which resides on the File System), i.e. "xyz" gets created in the Content database. So, When ASP.NET receives a request for the file, it first finds the file in the content database. This entry in the content database tells ASP.NET that the file is actually based on a file on the file system and therefore, ASP.NET retrieves the source of the file on the file system when it constructs the page.

Customized :

A customized file is one in which the source of the file lives exclusively in the site collection's content database. This happens When you modify the file in any way through the SharePoint API, or by SharePoint Designer 2007,which uses the SharePoint API via RPC and Web service calls to change files in sites. So, When the file is requested, ASP.NET first finds the file in the content database. The entry in the database tells ASP.NET whether the file is customized or uncustomized. If it is customized, it contains the source of the file, which is used by ASP.NET in the page contraction phase.

Q. What are event receivers?

Ans. Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.


Q. When would you use an event receiver?

Ans. Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.


Q. If I wanted to restrict the deletion of the documents from a document library, how would I go about it?

Ans. You would create a event receiver for that list/library and implement the ItemDeleting method. Simply, set: properties.Cancel= true and display a friendly message using Properties.Message("How can u delete this... Its not your stuff!");


Q. What is the difference between an asynchronous and synchronous event receivers?

Ans. An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding


Q. How do you Increase trust level for a single WebPart in the WebConfig file.

Ans. To list a Web Part with Full Permissions within your Web Application while still retaining a WSS_Minimal permission set for all other Web Parts, You need to create a Custom policy file. This file will be then referenced in SharePoint Web.config file and will allow your specific webpart to be of Full trust.
Steps :
1. Make a copy of the WSS_Minimal.Config file from the 12\Config folder and paste it into the same folder renaming it to Custom_WSS_Minimal.Config. Now, edit the Custom_WSS_Minimal.Config file using NotePad. Obtain the Public Key Token for the Web Part assembly that you want to deploy, using the following command: sn –Tp filename.dll. Create a new entry in your Custom_WSS_Minimal.Config file for your WebPart. Save the File.
Finally, Create a new TrustLevel element for your config file in the Web.Config called Custom_WSS_Minimal that points to your custom file in the 12\config folder. Recycle the Application Pool and You’re Done.


Q. How does Windows SharePoint Services help render the Webapplictaion in ShrePoint?

Ans. When a new web applictaion is created via Central Admin, Windows SharePoint Services creates a new Web application in IIS. Then the WSS, loads the custom HTTP application and replaces all installed HTTP handlers and modules with Windows SharePoint Services–specific ones. These handlers and modules essentially tell IIS to route all file requests through the ASP.NET 2.0 pipeline. This is because most files in a SharePoint site are stored in a Microsoft SQL Server database.

Q. How would you pass user credentials while using SharePoint WebService from your Web Part or application.

Ans. The web service needs credentials to be set before making calls.

Examples:

listService.UseDefaultCredentials = true; // use currently logged on user

listService.Credentials = new System.Net.NetworkCredential("user", "pass", "domain"); // use specified user


Q. How would you remove a webapart from the WebPart gallery? Does it get removed with Webpart retraction?

Ans. No, Webpart does not get removed from the WebPart gallery on retraction. You can write a feature receiver on Featuredeactivating method to remove the empty webpart from the gallery.


Q. What is a SharePoint Feature? Features are installed at what scope

Ans. A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, scope of which are defined as
1. Farm level 2. Web Application level 3. Site level 4. Web level
Features have their own receiver architecture, which allow you to trap events such as when a feature is Installing, Uninstalling, Activated, or Deactivated.



Q. What type of components can be created or deployed as a feature?

Ans. We can create menu commands, Custom Actions,page templates, page instances, list definitions, list instances,event handlers,webparts and workflows as feature.

Q. How Do you bind a Drop-Down Listbox with a Column in SharePoint List ?

Ans.
Method 1 : You can get a datatable for all items in the list and add that table to a data set. Finally, specify the dataset table as datasource for dropdown listbox.

Method 2 : You can also use SPDatasource in your aspx or design page.
See Code example Binding Drop-Down with Sharepoint List data



Q. How Does SharePoint work?

Ans. The browser sends a DAV packet to IIS asking to perform a document check in. PKMDASL.DLL, an ISAPI DLL, parses the packet and sees that it has the proprietary INVOKE command. Because of the existence of this command, the packet is passed off to msdmserv.exe, who in turn processes the packet and uses EXOLEDB to access the WSS, perform the operation and send the results back to the user in the form of XML.


Q. What is CAML?

Ans. CAML stands for Collaborative Application Markup Language and is an XML-based languagethat is used in Microsoft Windows SharePoint Services to define sites and lists, including, for Eg, fields, views, or forms, but CAML is also used to define tables in the Windows SharePoint Servies database during site provisioning. Developers mostly use CAML Queries to retrieve data from Lists\libraries.


Q. Can you display\add a Custom aspx or WebApplication Page in SharePoint Context ?

Ans. You need to make some modification in the aspx file to display it in SharePoint Context. Firstly, add the references for various sharepoint assemblies on the Page. Then wrap the Code in PlaceHolderMain contentPlaceholder, so that it gets displayed as a content page. Lastly, add a reference to SharePoint Master Page in aspx file and swicth it in Code behind if needed. See Code Example at Display aspx Page in SharePoint context

Welcome to SharePoint Server 2019, a modern platform for choice and flexibility

“Without continual growth and progress, such words as improvement, achievement, and success have no meaning.” Benjamin Franklin Thi...