In this blog, I am going to present some very awesome SharePoint interview questions collected from Stack Overflow—-one of my favorite technology forums. Moreover, I also collected some questions from other site, let say from internet. So thank you Stack Overflow, and the whole internet, especially SharePoint communities.
Enjoy!
Q: What is the difference between System.Web.UI.WebControls.WebParts.WebPart
and Microsoft.SharePoint.WebPartPages.WebPart
?
A: Microsoft.SharePoint.WebPartPages.WebPart
is provided in MOSS 2007 to provide backwards compatability with MOSS 2003 webparts. In MOSS 2007, it is recommended to use System.Web.UI.WebControls.WebParts.WebPart
instead.
Q. When running with SPSecurity.RunWithElevatedPrivileges (web context) what credentials are being used?
A. The App Pool Identity for the web application running SharePoint.
Q: Why would you use a custom column?
A: It allows you to re-use the column in multiple libraries. Particularly useful if you use a Choice type to restrict the user input to a predefined set of answers, and when that list of answers will likely change.
Q: Describe the difference between a list and a library.
A: Lists are collections of metadata or columns, that can have attached documents. Libraries are collections of documents (Excel, InfoPath, Word, etc.) plus optional metadata.
Q. When modifying a list item, what is the “main” difference between using SPListItem.Update() and SPListItem.SystemUpdate()?
A. Using SystemUpdate() will not create a new version and will also retain timestamps.
Q: What are “Features” and why should you know about them?
A: Anything from The concept of a “Feature” in SharePoint demonstrates an understanding.
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?
A. Before performing your update, call DisableEventFiring(). After update, call EnableEventFiring().
Q: (i) Describe the purpose of a content type and; (ii) give an example of where they might be used.
A: (i) A content type groups a set of list columns together so that they can be reused in the same way across sites. (ii) They could be used as a set of metadata columns that need to be applied to every document in a site collection.
Q: When should you dispose SPWeb and SPSite objects? And even more important, when not?
A: 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. More tricky constructs are things along the line of SPList.ParentWeb.
Q. What are the data types which are supported as Lookup column in SharePoint.
A. Only Single Line of Text and Calculated columns are supported as lookup columns.
Q: Name at least two shared services available in MOSS 2007
A: Shared Services Providers in MOSS 2007 can provide the following shared services:
- User Profiles
- Audiences
- Personal Sites
- Search
- Excel Services
- Forms Services
- Business Data Catalog (Requires Enterprise Edition)
Q. What base classes do event receivers inherit from?
A:
- SPListEventReceiver, SPItemEventReciever, and SPWebEventReceiver inherit from the abstract base class SPEventReceiverBase.
- SPWorkflowLibraryEventReceiver inherits from SPItemEventReceiver.
- SPEmailEventReceiver inherits directly from System.Object.
Q. What is a site collection, why would you create a new site collection as opposed to a site?
A. Bit of a long answer, but they should know about site collection administration, quotas, seperation of assets, security model etc.
Q. What is the difference between MOSS & WSS
A. MOSS uses the Shared Service Provider for search, profile import, etc… (see the answers posted by Lars Fastrup for a more complete list)
Q: What are the built in ways to backup a SharePoint install?
A: Through the central administration and the stsadm command
Q: (more advanced) You’ve created and deployed a Web Part, when you deploy to the server you get a page saying your Web Part couldn’t be loaded, click here to go to the Web Part maintenance page, etc. to disable the web part. What step(s) should you take to get a stack dump from your web part instead of that error page?
A: Go to the web.config file for your website and find the CallStack Attribute in the SafeControls element and set the value to true.
Q. How would you create a Master/Detail page?
A. Creating a Content type inheriting from Folder Content Type for the master, and another Content type inheriting from Item and using them both on a List
Q: What is the performance impact of RunWithElevatedPrivileges
?
A: RunWithElevatedPrivileges
creates a new thread with the App Pool’s credentials, blocking your current thread until it finishes.
Q: What is a way of elevating SharePoint privileges without using RunWithElevatedPrivileges?
A: Pass the System Account User Token from the SPContext to the SPSite constructor.
A majority of times a developer can accomplish what they need using this method without needlessly elevating network credentials.
Disclaimer: All of these SharePoint interview questions are from Stack Overflow, and condensed by me. The original questions, comments of the questions as well, can be found from that web site.