29 June 2012

SharePoint Interview Question and Answers

Q) Difference between MOSS and WSS
WSS is foundation and MOSS is optional add-on.
You cannot install MOSS of itself. If you try to do this, you will be requested to install WSS first.
Characteristics of WSS
It is a Web Based Application
It stores all information in an MS SQL database.
It displays information using web Parts.
It comes with site templates.
What WSS does not have?
There is no support for indexing and Searching.
It does not have advanced intranet features, such as targeted information and content management.
It has no record management.
It cannot display InfoPath forms in Web Browser.
It cannot display MS Excel spreadsheet as Web Part.
It comes with less than 10 Web parts.
It cannot Read and Write to External Database.
So to achieve all above task which WSS does not have, MOSS came into action.
MOSS 2007
Use global search functionality to find any type of information regardless of type and location.
Target information to one or more User Group.
Use Advanced Content Management.
Import User Data from Active Directory.
Use RSS web part to list information fetched from RSS feeds.
Give each SharePoint user a Personal Web Site.
Search, display content from external Database.
Comparison of Built in Feature of SharePoint
 Features       WSS    MOSS
Alerts            Yes     Yes
RSS              Yes     Yes
File and Document Management     Yes     Yes
Project Management Yes     Yes
Managing Meeting     Yes     NO
Update          NO      Yes
Finding Information   NO      Yes
Indexing        NO      Yes
External Data access NO      Yes
SSP is nothing but collection of configured service to work with MOSS.
Q) What are Site Pages?   how are they different from application pages?
Site pages are customized pages and are saved in to content database. So when you use the SharePoint designer to make custom changes it saves the changes in to content database. If you want to make generic pages in a site collection which will be used by every one, like for instance the ‘Settings.aspx’ page then you need to use application pages.
In other words Site pages are nothing but customized pages stored in content, while application pages are generic pages which will be used by all the sites in a site collection
Q) What are site columns?
Site columns allows you to create a lookup columns in one location and share the column with any custom lists that would need it.
 Q) What is a Site Definition? How can you create a new Site Definition?
A site definition is a collection of files that defines the structure & layout of site templates. Confused? Well, don't be. A site definition comprised of a webtemp.xml file which  in turn defined the order of various site templates available in that site definition. Site definition file also include a separate directory structure that includes all the other core files required. The webtemp.xml file is stored in %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML location and directory that contains all the core files is %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions \12\TEMPLATE\SiteTemplates.
Steps for creating a custom Site Definition
Step 1.Create a copy of existing site Definition structure by navigating to %COMMONPROGRAMFILES%\\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates. Rename the file as NewLOB (short form for New line of business).
Step 2. Navigate to %COMMONPROGRAMFILES%\\Microsoft Shared\web server extensions\12\TEMPLATE\1033 and copy the STS directory and paste it in the same strucutre and rename it as NewLOB.
Step 3. Create webTemp.xml file to register the site definition created in step 1&2.
Step 4. Reset IIS.
Thats it. Now, new site definition is available for use for the new line of business group.
Q) Explain the concept of ghosting/unghosting?
First of all, with the release of WSS 3.0, Microsoft has renamed the concept of ghosting/unghosting as uncustomized/customized pages .
In SharePoint most of the site pages derive from templates. The custom pages only store the difference between them. The template is loaded in memory and applied to the custom pages on fly. In other words the template is stored in a cache. This definitely brings in performance and flexibility. Flexibility is in terms that when we change the template page it’s applied to all custom pages. These pages are loaded from the file system. So pages which are loaded from the file system are termed as ghosted pages.
If the page data is loaded from the content database it’s termed as unghosted pages.
Q) Content types in SharePoint
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.
E.g : 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.
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)What is the difference between Syncronous & Asyncronous 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)How to query from multiple lists ?
Use SPSiteDataQuery to fetch data from multiple lists.
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)What is CAML, and why would you use it?
CAML stands for Collaborative Application Markup Language.
CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning.
CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.
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, such as at the farm, site collection, web, etc. Features have their own receiver architecture, which allow you to trap events such as when a feature is installing, uninstalling, activated, or deactivated. They are helpful because they allow ease of upgrades and versioning.
The two files that are used to define a feature are the feature.xml and manifest file. 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.
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 types of SharePoint assets can be deployed with a SharePoint feature?
With Features we can do a lot. For example, you could deploy as follows
    * Simple site customizations
    * Custom site navigation
    * WebParts
    * pages
    * list types
    * list instances
    * event handlers
    * workflows
    * custom actions
Q)What are event receivers?
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 .
SPListEventReceiver, SPItemEventReciever, and SPWebEventReceiver inherit from the abstract base class SPEventReceiverBase.
SPWorkflowLibraryEventReceiver inherits from SPItemEventReceiver.
SPEmailEventReceiver inherits directly from System.Object
Q) What are the built in ways to backup a SharePoint install?

Through the central administration and the stsadm command
Q) What are the differences between the two base classes ?
The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported:
    * Cross page connections
    * Connections between Web Parts that are outside of a Web Part zone
    * Client-side connections (Web Part Page Services Component)
    * Data caching infrastructure

Q) how can debugging share point application  ?
   1. build application place .dll into gac and reset iis
   2. On the Debug menu, select Attach to Process
   3. select the Show processes from all users check box.
   4. select W3Wp.exe can attach
   5. refresh sharepoint site point break point

Q) Difference SPSite and SPWeb object
The SPSite object represents a collection of sites (site collection [a top level sites and all its subsites]).
The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content.
A SPSite object contains the various subsites and the information regarding them.
      SPSite rootSite = new SPSite("http://jaganinfo-pc:1234/");
       SPWeb objWeb = rootSite.OpenWeb();

Q) How do you connect to a SharePoint list and insert a new List Item?
using(SPSite rootSite = new SPSite("http://jaganinfo-pc:1234/"))
{
          using(SPWeb objWeb = mySite.OpenWeb())
          {
                   SPList interviewList = myWeb.Lists["listtoinsert"];
                   SPListItem newItem = interviewList.Items.Add();
                   newItem["interview"] = "interview";
                   newItem.Update();
          }
}
Q) How would you loop using SPList through all SharePont List items, assuming you know the name (in a string value) of the list you want to iterate through, and already have all the site code written?
          SPList interviewList = rootWeb.Lists["listtoiterate"];
          foreach (SPListItem interview  in interviewList)
          {
                   // Append the code as per your requirement
          }

Q) How could you append a string to the title of a site when it is provisioned?
In the OnActivated event:
          SPWeb objWeb = siteCollection.RootWeb;
          objWeb.Title += "JaganInfo.com";
          objWeb.Update();

Q) What is the difference between SPListItem.SystemUpdate and SPListItem.Update Method
SPListItem.SystemUpdate:
Updates the database(Sharepoint list) with changes that are made to the list item, without effecting changes in the Modified Time or Modified By fields.
SPListItem.SystemUpdate Overloaded Method:
SPListItem.SystemUpdate():
Updates the database with changes made to the list item, without effecting changes in the Modified or Modified By fields.
SPListItem.SystemUpdate(Boolean):
Updates the database with changes that are made to the list item, without effecting changes in the Modified Time or Modified By fields, or optionally, the item version.
SPListItem.Update():
Updates the database(Sharepoint list) with changes that are made to the list item/new version of item, and changes in the Modified Time or Modified By fields.
//Take the reference of that item
          SPListItem listItem = listItemCOll[icount];
          listItem["FIRST_NAME"] = “Jagan”;
          listItem["LAST_NAME"] = “Mohan”;
          listItem["EMAIL_ADDR"] = “jaganinfoway[at]gmail.com”;
          //Update the Item
          listItem.SystemUpdate(false);
//The argument false informs the SP object Model not increment versions.
          listItem.Update();