Social Networks

SharePoint Interview Questions With Answers

Click here to Download the all SharePoint Interview Questions With Answers

Q. What are content types?

Ans. A content type is a flexible and reusable WSS type definition (or we can a template) that defines the columns and behavior for an item in a list or a document in a document library. For example, you can create a content type for a leave approval document with a unique set of columns, an event handler, and its own document template and attach it with a document library/libraries.

Q. Can a content type have receivers associated with it?

Ans. Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

Q. What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?

Ans. There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

Q. Can a list definition be derived from a custom content type?

Ans. Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

Q. While creating a Web part, which is the ideal location to Initialize my new controls?

Override the CreateChildControls method to include your new controls. You can control the exact rendering of your controls by calling the .Render method in the web parts Render method.

Q. How do you return SharePoint List items using SharePoint web services?

Ans. In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.

Q. What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?

Ans. ClassResources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.


Q. What are event receivers?

Ans. Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.

Q. When would you use an event receiver?

Ans. Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

Q. If I wanted to not allow people to delete documents from a document library, how would I go about it?

Ans. You would on the ItemDeleting event set: properties.Cancel= true.

Q. What is the difference between an asynchronous and synchronous event receivers?

Ans. An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding

Q. While creating a Webpart, which is the ideal location to Initialize my new controls ?

Ans. Override the CreateChildControls method to include your new controls. To make sure that the new controls are initialized.. call ‘EnsureChildControls’ in the webparts Render method. You can control the exact Rendering of your controls by calling the .Render method in the webparts Render method.

Q. How to query from multiple lists ?

Use SPSiteDataQuery to fetch data from multiple lists.

What does AllowUnsafeUpdates do ?

If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property. C#:

view sourceprint?

using(SPSite mySite = new SPSite("yourserver"))

{ using(SPWeb myWeb = mySite.OpenWeb())


myWeb.AllowUnsafeUpdates = true;

SPList interviewList = myWeb.Lists["listtoinsert"];

SPListItem newItem = interviewList.Items.Add();

newItem["interview"] = "interview";




Click here to Download to see answers for below and other so many important SharePoint Interview Questions With Answers

Q What does RunWithElevatedPrivileges do?

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

Q) What are content types ?

Q. Workflow can be applied to what all elements of SharePoint ?

Q. What are the types of input forms that can be created for a workflow ?

Q. What are ways to create input forms for workflow ?

Q. What is the difference between method activity and event activity in WF ?

Q. What does SPWeb.EnsureUser method do?

Q. While creating a Webpart, which is the ideal location to Initialize my new controls ?

Q. How to query from multiple lists ?

Q.How Does SharePoint work?

Q. What is the difference between Syncronous & Asyncronous events?

Q. What is ServerUpdate() ?

None found.

Leave a Reply

Your email address will not be published. Required fields are marked *

Allowed Tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>