Wednesday, September 25, 2013

SharePoint Interview Questions and Answers

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. 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 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. 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. 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. 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.Describe the purpose of a content type

A content type groups a set of list columns together so that they can be reused in the same way across sites. They could be used as a set of metadata columns that need to be applied to every document in a site collection.

Q. How would you programmatically retrieve a list item?

A: SPQuery and SPSiteDataQuery

No comments:

Post a Comment