Interview Questions Of SharePoint Programming

These are the Interview question related to SharePoint object model and its Webservices. Some of the questions also apply to SharePoint 2010 object model.

Q. Where are the files deployed in SharePoint 2007 ?

Ans. Developers generally deploy various files in the in the 12 hive folders that make SharePoint Interface. For e.g. if a Custom Css file needs to be deployed it will go under
"C:\Program Files\Common Files\Microsoft Shared\Web Server Extenstions\12\Templates\Layouts\1033\Styles" path. This path is well mapped with Out-of-box SharePoint components and is suppose to contain Custom and Out-of-Box Css files.

Q. How are these files deployed?

Ans. Solution packages or wsp are used to deploy or drop these files in various 12 hive folders.  The manifest.xml (solution package file ) contains various tags such as  or  to drop in these files in the 12 hive. Tags in manifest.xml file are well mapped with the 12 hive folders, so all you need is to provide a virtual location for a folder under Templates to drop your file in Files.

Q. How can you add an existing user control on a SharePoint Page ? Do you need to make any modifications to the control ?

Ans. You can either use a Custom webpart or a smartPart webpat to load your usercontrol in the page.  You can also add a user control to a master page if that's your requirement. You must drop the signed assembly for the UserControl in GAC and add the usercontrol in _ControlTemplates folder under 12 hive.

Q.  If you create a event receiver feature how can you bind it with one specific list.

Ans. We can create a FeatureReceiver and write some code in  FeatureActivating method of the FeatureReceiver to assign the specific list to the event receiver feature itself.

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. What is the difference between SPQuery and SPSiteDataquery ?

Ans. SPQuery is a CAML query used to retrieves items fromone perticular list . SPSiteDataquery on the other hand retrieves items from multiple lists and libraries in the same site collection. you can however, specify the Guid of the Lists for the SPsiteDataQuery to run on.

Q. How can you display data from a Parent site in a Subsite or Cross sites ?

Ans. Even though, its difficult to do this Out-of-box we have sevral options :
1. Using sharepoint designer – We can use DataviewWebPart and choose to connect to a different site and after creatign a connection, you will be listed with all list and libraries of the parent site or the cross site or site collection.

2. Use Site Lookup column – We can also create a column in the parent site as a Site column of type Lookup and then can add this column in subsites list\library.

3. Can export a listView webpart from a parent site (ofcourse displaying parent site list data) and import it into any subsite page.

Q. How do you display an infopath form on any SharePoint page.

Ans. You need to use xmlformviewer webpart to display the admin uploaded infopath form.