Sharepoint Interview Questions with Answers

Sharepoint Interview Questions with Answers

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.

sharepoint 2010 designer

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 AllowUnsafeUpdatesdo ?

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#:

viewsourceprint?

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

{ using(SPWebmyWeb = mySite.OpenWeb())

{

myWeb.AllowUnsafeUpdates = true;

SPListinterviewList = myWeb.Lists["listtoinsert"];

SPListItemnewItem = interviewList.Items.Add();

newItem["interview"] = "interview";

newItem.Update();

}

}

Q What does RunWithElevatedPrivileges do?

Assume that you have a Web Part in which you want to display information obtained through the Windows SharePoint Services object model, such as the name of the current site collection owner, usage statistics, or auditing information. These are examples of calls into the object model that require site-administration privileges. Your Web Part experiences an access-denied error if it attempts to obtain this information when the current user is not a site administrator. The request is initiated by a nonprivileged user. you can still successfully make these calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class. C#:

viewsourceprint?

SPSitesiteColl = SPContext.Current.Site;

SPWeb site = SPContext.Current.Web;

SPSecurity.RunWithElevatedPrivileges(delegate()

{

using (SPSiteElevatedsiteColl = new SPSite(siteColl.ID))

{

using (SPWebElevatedSite = ElevatedsiteColl.OpenWeb(site.ID))

{

stringSiteCollectionOwner = ElevatedsiteColl.Owner.Name;

string Visits = ElevatedsiteColl.Usage.Visits.ToString();

stringRootAuditEntries = ElevatedSite.RootFolder.Audit.GetEntries().Count.ToString();

}

}

});

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.
Scopes include

Farm

WebApplication

Site (site collection)

Web (site)

Features have their own receiver architecture, which allow you to trap events such as when a feature is

installing

uninstalling

activated

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

workflows

The two files that are used to define a feature are

feature.xml

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.
Common stsadm commands associated with feature are

stsadm -o installfeature

stsadm -o uninstallfeature

stsadm -o activatefeature

stsadm -o deactivatefeature

Q) What are content types ?

A content type is a flexible and reusable WSS type definition 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 customer presentation document with a unique set of columns, an event handler, and its own document template.
-You can create a second content type for a customer proposal document with a different set of columns, a workflow, and a different document template.
Then you can attach both the contenttypes to a document library, which allows you to capture metadata based on the contenttype selected during creation of the document.

Content type can be created by the following

from the rootweb of a site collection, go to Site Action > Site Settings > Galleries > Site content types

using a feature

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

While workflow associations are often created directly on lists and document libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list.
In short, it can be applied ...

At the level of a list (or document library)

At the level of a content type defined at site scope

At the level of a site ( Sharepoint 2010 )
- What are the ways to initiate the workflow ?

Automatic (on item added or item deleted)

Manual (standard WSS UI interface)

Manual (Custom UI Interface)

Programatically through custom code

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

You can create four different types of input forms including an association form, an initiation form, a modification form, and a task edit form. Note that these forms are optional when you create a workflow template.

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

Two different approaches can be used to develop custom input forms for a WSS workflow template.

You can create your forms by using custom application pages, which are standard .aspx pages deployed to run out of the _layouts directory. ( disadv: lot of code required when compared to Infopath approach)

using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

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

A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring.

Q. What does SPWeb.EnsureUser method do?

Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site. e.gSPUserusr = myWeb.EnsureUser("mmangaldas");

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

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. more details..

Q.How Does SharePoint work?

The browser sends a DAV packet to IIS asking to perform a document check in. PKMDASL.DLL, an ISAPI DLL, parses the packet and sees that it has the proprietary INVOKE command. Because of the existence of this command, the packet is passed off to msdmserv.exe, who in turn processes the packet and uses EXOLEDB to access the WSS, perform the operation and send the results back to the user in the form of XML.

Q. What is the difference between SyncronousAsyncronous events?

Syncronous calls ending with 'ing' E.g. ItemDeleting Event Handler code execute BEFORE action is committed WSS waits for code to return Option to cancel and return error code
Asyncronous calls ending with 'ed' E.g. ItemDeleted Event Handler code executes AFTER action is committed WSS does not wait for code to return Executed in its own Worker thread.

Q. What is ServerUpdate() ?

Any changes in the list, i.e. new addition or modification of an item..the operation is complete by calling the Update method.But if a List is set to maintain versions .. and you are editing an item, but don't want to save it as a new version, then use the SystemUpdate method instead and pass in 'false' as the parameter.

Q. What is query.ViewAttributes OR How can you force SPQuery to return results from all the folders of the list?

If you use SPQuery on any SPlist ..it will bring back results from the current folder only. If you want to get results from all the folders in the list..then you need to specify the scope of the query by the use of ViewAttributes..
e.g. query.ViewAttributes = "Scope=\"Recursive\"";

Q. What is the difference between an Internet and an intranet site?

An internet site is a normal site that anyone on the internet can access (e.g., etc.). You can set up a site for your company that can be accessed by anyone without any user name and password.
An intranet (or internal network), though hosted on the Web, can only be accessed by people who are members of the network. They need to have a login and password that was assigned to them when they were added to the site by the site administrator

Q. What are the various kinds of roles the users can have?

A user can be assigned one of the following roles

Reader - Has read-only access to the Web site.
Contributor - Can add content to existing document libraries and lists.
Web Designer - Can create lists and document libraries and customize pages in the Web site.
Administrator - Has full control of the Web site.

Q. How customizable is the user-to-user access?

User permissions apply to an entire Web, not to documents themselves. However, you can have additional sub webs that can optionally have their own permissions. Each user can be given any of four default roles. Additional roles can be defined by the administrator.
Can each user have access to their own calendar?
Yes there are two ways to do this,

by creating a calendar for each user, or
by creating a calendar with a view for each user

Q. Can SharePoint be linked to a SQL database?

This is possible via a custom application, but it not natively supported by SharePoint or SQL Server.

Q. What does partial trust mean the Web Part developer?

If an assembly is installed into the BIN directory, the code must be ensured that provides error handling in the event that required permissions are not available. Otherwise, unhandled security exceptions may cause the Web Part to fail and may affect page rendering on the page where the Web Part appears

SharePoint 2010 Logo

SharePoint_2010_Logo

Q. What is a content type?

A content type is an information blueprint basically that can be re-used throughout a SharePoint environment for defining things like metadata and associated behaviors. It is basically an extension of a SharePoint list, however makes it portable for use throughout an instance regardless of where the instantiation occurs, ergo has location independence. Multiple content types can exist in one document library assuming that the appropriate document library settings are enabled. The content type will contain things like the metadata, listform pages, workflows, templates (if a document content type), and associated custom written functionality.

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

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?

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. What is an ancestral type and what does it have to do with content types?

An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

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

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. When creating a list definition, how can you create an instance of the list?

You can create a new instance of a list by creating an instance.XML file.

Q. What is a Field Control?

Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

Q. What base class do custom Field Controls inherit from?

This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

Q. What is a SharePoint site definition? What is ghosted (uncustomized) and unghosted (customized)?

SharePoint site definitions are the core set of functionality from which SharePoint site are built from, building from the SiteTemplates directory in the SharePoint 12 hive. Site definitions allow several sites to inherit from a core set of files on the file system, although appear to have unique pages, thereby increasing performance and allowing changes that happen to a site propagate to all sites that inherit from a site definition. Ghosted means that when SharePoint creates a new site it will reference the files in the related site definition upon site provisioning.Unghosted means that the site has been edited with an external editor, and therefore the customizations are instead stored in the database, breaking the inheritance of those files from the file system.

Q. How does one deploy new SharePoint site definitions so that they are made aware to the SharePoint system?

The best way to deploy site definitions in the SharePoint 2007 framework is to use a SharePoint solution file, so that the new site definition is automatically populated to all WFE’s in the SharePoint farm.