Important SharePoint Interview Questions
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 andMicrosoft.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. 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 ?
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. 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 Increase trust level for a single WebPart for in the WebConfig file.
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 follow these steps:
1. Make a copy of the WSS_Minimal.Config file from the 12Config folder and paste it into the same folder renaming it to Custom_WSS_Minimal.Config.
2. Edit the Custom_WSS_Minimal.Config file with an XMLeditor such as Visual Studio.NET or NotePad.
3. Obtain the Public Key Token and Public Key Blob for the Web Part assembly that you want to deploy using the following command: sn –Tp filename.dll.
4. Create a new entry in your Custom_WSS_Minimal.Config file for your WebPart.
5. 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 12config folder.
6. Set the Trust Level of the Web.Config to Custom_WSS_Minimal
7. Recycle the Application Pool or run IISReset
8. Deploy & Test your Web Part.
Q. What SharePoint Databases are Created during the standard Install?
Ans. During standard install, the following databases are created :