Wednesday, September 3, 2008

Sharepoint faqs

SharePoint Interview Questions:

hi,

Here are a few questions which can be usefull in a interview.
Compiled from various sources on net, I will try to keep it updated ...



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, scope of which are defined as
1. Farm level 2. Web Application level 3. Site level 4. Web level
Features have their own receiver architecture, which allow you to trap events such as when a feature is
Installing, Uninstalling, Activated, or 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, and workflows.

The two files that are used to define a feature are the feature.xml and 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.


Workflow can be applied to what all elements of SharePoint ?
Workflow associations are often created directly on lists and 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/library
At the level of a content type defined at site scope
At the level of a content type defined at list scope

What are the types of input forms that can be created for a workflow ?
You can create four different types of input forms including
1. An association form
2. An initiation form
3. A modification form
4. A task edit form.

Note that these forms are optional when you create a workflow template.

What are ways to create input forms for workflow ?
Two
1. 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)
2. Using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

What is the difference between method activity and event activity in WorkFlow ?
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.

What are content types?
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.
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.

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.

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.

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.

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

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.

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.

Can multiple SharePoint installs point to the same DB?
Multiple SharePoint installs can use the same database server. Not literally the same database on that server. That server must be SQL Server 2000 or SQL Server 2005. It cannot be Oracle or another vendor.

How to create links to the mapped network drives?
Creating links to mapped drives in WSS v3 or MOSS 2007 can be done via
the new content type for .lnk files.

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.

What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?
There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the
SharePoint WebPart Base class
or the
ASP.NET 2.0 WebPart base class.
When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:
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

What are the differences between the two base classes and what are the inherit benefits of using one over another?
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
ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

What is the WebPartManager sealed class? What is its purpose?
The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.”

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.

What does RunWithElevatedPrivileges do?
There are certain object model calls model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when request is initiated by a nonprivileged user. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.
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.g SPUser usr = myWeb.EnsureUser("hitenders");

What is a SPSite and SPWeb object, and what is the difference between each of the objects?
The SPSite object represents a collection of sites (site collection [a top level site 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.

What does a SPWebApplication object represent?
The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?
Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address.

How do you return SharePoint List items using SharePoint web services?
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.
Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?
In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations.

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.

What is impersonation, and when would you use impersonation?
Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?
Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire.
Each custom property that you have must have the appropriate get and set accessor methods.

What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?
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.

What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?
A SharePoint solution file is essentially a .cabinet file with all a developers ustom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution:
allows deployment to all WFE’s in a farm
is highly manageable from the interface allowing deployment, retraction, and versioning
Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc.
Can provide Code Access Security provisioning to avoid GAC deployments
And much more..

What is a .ddf file and what does it have to do with SharePoint Solution creation?
A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution file.

What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?
The solution Manifest.XML file.

What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?
SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

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.

When would you use an event receiver?
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.

What base class do event receivers inherit from?
Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

If I wanted to not allow people to delete documents from a document library, how would I go about it?
You would on the ItemDeleting event set: properties.Cancel= true.

What is the difference between an asynchronous and synchronous event receivers?
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

Tuesday, June 10, 2008

Introduction To Sharepoint

Introduction To Sharepoint Products and Technologies

WHAT IS SHAREPOINT ?

SharePoint is an extensible and scalable portal-based collaboration and document management platform from Microsoft
consisting of tools and technologies that collectively form what is known as SharePoint Products and Technologies. SharePoint
web sites and pages are commonly used to build intranet and extranet portals and team sites, as well as public-facing Internet
sites. SharePoint is a great platform upon which you can build business applications to help you better store, share, and manage
digital information within your organization. Because you can build with or without the need for code, SharePoint empowers the
average business user to create, deploy, and manage team web sites, without depending on skilled resources, such as systems
administrators or developers.


HISTORY OF SHAREPOINT
Around 2000, Microsoft unveiled an application called a Digital Dashboard. This web-based application used a new concept called web parts, which are rectangular areas on a web page that display some type of information, such as a list of contacts, links,or documents. This was innovative because the user could now arrange the web parts on the web page herself, without any help from an HTML programmer.

In 2001, Microsoft released its first two SharePoint products. One was SharePoint Team Services (STS), and the other was SharePoint Portal Server (SPS). STS was a free web-based product used for collaboration. You could use it to share contacts,calendar events, and documents within teams and small departments. The information was stored in an MS SQL database. It wasa nice application, but it did not have any document-management features, and it was not built for creating intranet solutions for larger organizations. SPS was a separate product using a built-in MS Exchange 2000 server database. This new SPS had built-in
document-management features, such as document versioning, check-out/check-in, and document workflow. It also had a good search engine that allowed the user to find information, regardless of where it was stored. One serious problem with SPS was the
quality of its performance and the limited number of documents it could manage. And it did not have some of the nice collaboration features that STS had. Also, SPS was not free like STS, but licensed per server and per user.
In October 2003, Microsoft released its second generation of SharePoint. The old STS, now renamed Windows SharePoint
Services (WSS), was basically a fancier version of STS (internally, Microsoft referred to it as STS version 2). SPS kept its name,
SharePoint Portal Server, but that was about all that was kept from the previous SPS version. No longer did SPS have its own MS Exchange database, and no longer was SPS a separate product! Now it was an add-on to the WSS application. Finally, Microsoft
had one integrated SharePoint solution, completely based on the MS SQL Server database.
Still, there were some annoying things about the SharePoint 2003 editions. Although they now looked very similar, they did not behave in a similar way. For example, the permission settings for lists in WSS was different from the same type of lists in SPS,
and while SPS was security-trimmed (users only saw what they were allowed to see), WSS was not.
At the end of 2006, Microsoft released the third generation of SharePoint. WSS kept its name, and the version number changed to WSS 3.0. WSS still was a free add-on for Windows 2003 Server and used an MS SQL–based server to store its content.
Its bigger brother SPS was now renamed MS Office SharePoint Server 2007 (MOSS), but it was still an optional add-on to WSS and was using the same MS SQL database as WSS. The MOSS server was available in different editions and with optional services,
such as MOSS 2007 Standard and MOSS 2007 Enterprise, plus Office Forms Server and Office SharePoint Server 2007 for Search.


MICROSOFT SHAREPOINT PRODUCTS AND TECHNOLOGIES
Microsoft’s SharePoint Products and Technologies suite primarily consists of
Microsoft Windows SharePoint Services 3.0(WSS 3.0), and
Microsoft Office SharePoint Server 2007 (MOSS).

Windows SharePoint Services 3.0 (WSS 3.0)

Windows SharePoint Services is a component of Microsoft Windows Server 2003. It is provided as a free download and gives
you a powerful toolset for organizing information, managing documents, increasing the efficiency of business processes, and
providing robust collaboration environments.
Windows SharePoint Services helps teams stay connected and productive by providing an infrastructure that allows easy
access to the people, documents, and information they need. With Windows SharePoint Services, teams can create Web sites to
share information and foster collaboration with other users. You can access content stored within a SharePoint site from a Web
browser and through desktop applications, such as Microsoft Office.


SharePoint sites provide places to capture and share ideas, information, communication, and documents. The sites facilitate
team participation in discussions, shared document collaboration, blogging, building knowledge bases using wikis, and surveys.
A SharePoint site can have many subsites, the hierarchy of which, on Web servers, resembles the hierarchy of folders on file
systems -- it is a tree-like structure.
The key components of SharePoint sites are lists and libraries.

* A SharePoint list contains rows and columns of data, much like a standard database table. SharePoint lists, however, are
much easier to create and maintain. They are great for collecting and sharing fielded information such as contact lists,
calendars of events, or custom information of any kind.

* A SharePoint library is similar to a list, except that it exists solely to store a collection of documents. Each list item
describes one document, providing information such as the file name, the file title, the date last modified, and the person who last modified the document. SharePoint libraries can retain multiple versions of each document, and they support
change control through document check-in and check-out. Windows SharePoint Services supports special library types
for pictures and for InfoPath forms.
Organizing these lists and libraries into team sites places most administration and content management in the hands of team
members who are close to the work and familiar with the subject matter. This avoids the bureaucracy and the waiting times that are
typical of strictly centralized administration. But at the same time, Microsoft provides all the tools that centralized administrators
need to keep the installation under control and running smoothly. Team members can access SharePoint Web sites using eithera browser or an Office 2007 application. Individuals in teams can configure lists and libraries to record whatever information theywant, and they can easily create shared work areas for documents, projects, and other work in progress. Members can sign up toreceive change notifications by e-mail.
You can also use Windows SharePoint Services as a development platform for creating custom collaboration and informationsharing applications. For example, third-party or in-house programmers can access SharePoint sites using Web services or readilyaccessible application programming interfaces. In addition, you can develop custom Web pages using SharePoint Designer
2007, and custom objects using Visual Studio.

Microsoft Office SharePoint Server 2007 (MOSS)
Microsoft Office SharePoint Server 2007 is built on top of Windows SharePoint Services. It extends Windows SharePoint
Services by providing flexible organization and management tools for SharePoint sites and by making it possible for teams to
publish information to the entire organization. Because MOSS requires Windows SharePoint Services, all features of Windows
SharePoint Services are available in MOSS. However, Microsoft Office SharePoint Server 2007 provides significant additional
enterprise-level capabilities, as detailed in the following list.
* Collaboration: The collaboration components build on Windows SharePoint Services collaboration functionality to help
keep teams connected and productive by providing easy access to people, documents, and information.
* Portal: The portal components of MOSS include features for designing, deploying, and managing enterprise intranet
portals, corporate Internet-presence Web sites, and divisional portal sites.
* Enterprise Search: The search components provide a consistent search experience, relevance of search results, functions
to search for people and expertise, ability to index and search data in line-of-business applications, and extensibility.
* Enterprise Content Management: Windows SharePoint Services provides core document management functionality
including major and minor versioning, check-in/check-out document locking, rich descriptive metadata, workflow, content
type–based policies, auditing, and role-based permissions at the document library, folder, and individual document levels.
MOSS builds on these capabilities to deliver enhanced authoring, business document processing, Web content management
and publishing, records management, policy management, and support for multilingual publishing.
* Business Process and Forms: This component provides a platform for rapid creation and deployment of XML-based
electronic forms, centralizes form management and maintenance, and helps to extend business processes to customers,
partners, and suppliers.
* Business Intelligence (BI): The BI features of MOSS provide Web and programmatic access to published Excel
spreadsheets, programmatic reuse of critical line-of-business data, and development of Web-based BI dashboards.
While WSS is a free component, MOSS must be licensed separately. MOSS comes in several different versions that target different deployment scenarios and have different licensing requirements. Regardless of your scenario, however, every organization using MOSS must purchase the base MOSS server license. Along with the server license, you must also purchase the appropriate client access licenses (CAL) to meet your needs. For general use, MOSS comes in a Standard and an Enterprise edition. The Standard edition gives you access to the basic set of MOSS functionality, including content management, workflow, and collaboration. The Enterprise edition includes the functionality of the Standard edition but adds the BDC, Excel Services, Office
Forms Server, and more. Additional versions allow you to use MOSS solely for deploying Internet sites or separate features such
as the Microsoft Office SharePoint Server 2007 for Search editions, and Microsoft Office Forms Server editions. To decide whether you need Windows SharePoint Services by itself or an edition of Microsoft Office SharePoint Server 2007,
you need to assess how your requirements are met by the particular features and functionality of these products.