Thursday, February 11, 2010

SharePoint Interview Questions for Developers

SharePoint Interview Questions for Developers

Q. What Do you know about SharePoint Object Model?

Ans. In Sharepoint Object model there are two Important namespaces, Microsoft.Office.Server and Microsoft.SharePoint . 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 Here.


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. 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. How Do you use\refer External Javascript and Css file in your WebPart?

Ans. You can use javascript,Css or Image files placed in _Layouts or any other location by registering them on the webpart page. See Code examples at Using External Javascript, CSS or Image File in a WebPart.


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

Ans. Yes, Following modification are required in the Page to display it in SharePoint.

1. Add the references for various sharepoint assemblies on the Page.

2. Wrap the Code in PlaceHolderMain contentPlaceholder, so that it gets displayed as a content page.

3. Specify SharePoint Master in aspx and Code behind. You can switch the master page in code behind of the Page as well.

See Code Example at Adding a Custom aspx Page to Sharepoint .

Q: When should you dispose SPWeb and SPSite objects? And even more important, when not?

Ans. You should always dispose them if you created them yourself, but not otherwise. You should never dispose SPContext.Current.Web/Site and you should normally not dispose SPWeb if IsRootWeb is true.


Q. When modifying a list item, 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. If you have an ItemUpdated or ItemUpdating event receiver and it causes an update to the item, how do you prevent another ItemUpdated and ItemUpdating event from being fired during your update?

Ans. Before performing your update, call DisableEventFiring(). After update, call EnableEventFiring().


Q. What is a SharePoint Feature? What files are used to define a feature?

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.

The element types that can be defined by a feature include
menu commands, link commands, page templates, page instances, list definitions, list instances,
event handlers, and workflows.

The two files that are used to define a feature are the feature.xml and manifest file(elements.xml). The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.


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

No comments:

Post a Comment