Vous êtes sur la page 1sur 33

What is SharePoint?

• SharePoint is Microsofts enterprise information portal. It can be configured to run


Intranet, Extranet and Internet sites.
• Microsoft Office SharePoint Server 2007 allows people to connect and
collaborate.
• A SharePoint enterprise portal is composed of SharePoint Portal and Windows
SharePoint Services.
• SharePoint Server is designed medium to large company wide enterprise portal.

What is Microsoft SharePoint Portal Server?

MS SharePoint Portal Server is an integrated suite from server side, to help improve
organizational effectiveness with the help of providing

- comprehensive content management


- enterprise search
- accelerating shared business processes
- facilitating information sharing across boundaries
- Provides platform which includes server administration, application extensibility and
interoperability for IT professionals.

How is SharePoint Portal Server different from the Site Server?

SharePoint Portal Server:

- Web site creation for information sharing and document collaboration is treated as
services by SharePoint Portal Server.
- SharePoint server services are key information worker infrastructure that provides
additional functionality to the MS Office system applications. Site Server:
- Manages websites with multiple technologies
- Content management, product management, order processing , advertisement serving
are some of the functionalities

How is security managed in SharePoint?

Share point uses digital dashboard technology that provides an interface for the purpose
of creating web parts and making them appear them on dash boards. The security is
applicable throughout the organization.

What is Windows SharePoint Services?

Creation of websites for information sharing and document collaboration will be enabled
by Windows SharePoint Services. It provides additional functionality for MS Office
system and other desktop applications. It also supports like a platform for the
development of applications.
What is a SharePoint site definition?

A SharePoint site definition is a combination of files which reside on the Web server and
defines a unique SharePoint site. Every template on the web site tab of New dialog box is
utilized a site definition. For example, one site definition defines the Team site, Bank site
and another site definition defines the Meeting workspaces like Basic Meeting
Workspace, Decision Meeting Workspace, and Social Meeting Workspace etc.

What is CAML?

CAML is an acronym for Categorical Abstract Machine Language. CAML is statically


typed, strictly evaluated, and uses memory management automatically. LISP is the first
CAML implementation. CAML Light was implemented in C. CAML Special Light is
added a powerful module system to the core language, in addition to complete rewriting,
Objective CAML is the current implementation of CAML, which adds an object layer.

How to display information from data source in SharePoint site?

Here, we will learn to apply nice formatting to data that is displayed on our page. We will
learn to do this by making use of Cascading Style Sheets. We will also learn how to
format our data automatically, depending on the data values (a technique known as
conditional formatting). Then we will learn to filter and sort our data, use formulae to
perform calculations, and how to split our data up into multiple pages.

What is Microsoft SharePoint Portal Server?

Microsoft Office SharePoint Server 2007 is a collaborative enterprise portal that is built
upon WSS 3.0. MOSS 2007 allows people, teams and expertise to connect and
collaborate. Unlike WSS, SharePoint Server is not free and requires an additional license.
MOSS 2007 comes in two versions – Standard and Enterprise. The main components of
SharePoint 2007 are collaboration, portals, enterprise search, enterprise content
management, business process and forms, and business intelligence.

How is SharePoint Portal Server different from the Site Server?

It becomes difficult to keep a track of the large amount of documents with the growth of
companies. SharePoint lets these be stored centrally. So instead of having them shared
via emails, Sharepoint allows an easy access to the members by storing the files at one
place. SharePoint allows anyone to create sites for use within their company’s Intranet

How is security managed in SharePoint?


Authentication
SharePoint can run under various IIS modes to authenticate its users. The modes include:
Anonymous, Basic, Integrated Windows or Certificates Authentication (over SSL).

Authorization
SharePoint security facilitates the regulation of access privileges of users and groups as
well.

Impersonation
.NET Impersonation which is utilized by SharePoint allows an application to run under
the context of the client accessing an application.

Deployment and Code Access Security


.NET Code Access Security (CAS) provides a security model. It can restrict the
operations that can be performed as well as the resources that can be accessed by
managed code.

What is Windows SharePoint Services?

Windows SharePoint Services 3.0 is the platform on which all SharePoint Products and
Technologies are built. It is suitable for small teams, projects and organizations.

WSS’s project collaboration, document workspace, meeting sub-site, and discussion


board features allow individuals and small teams to collaborate and share information
online.

New features in WSS 3.0 include


- integrated workflows,
- RSS feeds,
- blogs,
- wikis and
- ASP-style Web parts.

What is a SharePoint site definition?

SharePoint sites consist of numerous Web pages, just like an ASP.NET 2.0 application.

When a site is created, these pages are created as instances in the content database.

The instances refer to the actual file on the file system.

What is CAML?

CAML stands for Collaborative Application Mark-up Language.


CAML is used to define tables in the Windows SharePoint Services database during site
provisioning.

It is an XML-based language that is used in Microsoft Windows SharePoint Services to


define sites and lists.

his exercise consists of the following major topics:

Formatting the Data View


Direct Formatting
CSS Formatting
Conditional Formatting
Formatting Numbers
Filtering Data
Using Formulae
Sorting Data
Allowing Users to Sort the Data
Paging

Formatting the Data View

The default data view that we are presented with uses uninspiring black serif text on a
white background. We can jazz up our data view using two different methods:

Direct Formatting

It is possible to apply formatting directly to our data view by highlighting the cells that
we wish to format and then using the formatting tools. This can be a good option if we
only want to format a single data view but is not the best approach if we would like to
apply our formatting on a site-wide basis.

CSS Formatting

A more manageable way to apply formatting to our data views is to make the changes
across the entire site by editing our style sheet.

When we click in the cell that has the Price heading in it, notice that a tag appears above
it, telling us that this cell is referred to as th.ms-vh. That is to say that it is a table heading
(th) element that is being rendered using the ms-vh class (which I assume stands for
Microsoft View Heading). Similarly, if we click in any of the cells further down the data
view, we see that they are referred to as td.ms-vb (standing for Microsoft View Body).
This reference is used to specify the format of the cells in our table that display the actual
data.
In addition, there is an ms-alternating class that renders every other row with a different
background color.

To allow us to edit our styles, we must fi rst create a new blank style sheet, which we will
call share.css:

1. Select File | New | CSS.


2. Go to File | Save.
3. Give the fi le the name share.
4. Save the fi le as CSS Files fi le type.
5. Click Save.

The next step is to attach our style sheet to our site so that our pages can refer the styles
that we will create within the style sheet:

1. Open the Apply Styles task pane.


2. Click Attach Style Sheet.
3. Click Browse.
4. Browse to share.css and click it.
5. Click Open.
6. Under Attach to, check All HTML pages.
7. Click OK.
8. Click Close on the information dialog.

We will then make our style sheet ready to use by defi ning some styles. Adding the
following code to the style sheet will change the ms-vh and ms-vb classes so that they are
formatted in a more inspiring manner:

th.ms-vh, td.ms-vb {
font-family:gill sans, gill sans mt, arial, sans-serif;
}
th.ms-vh {
border-width:0px;
background-color:#903;
color:#FFF;
}
td.ms-vb {
color:#903;
border-top-width:0px;
border-left-width:0px;
border-right-width:0px;
border-bottom-width:1px;
border-bottom-style:dashed;
font-style:italic;
}
ourtable{
border-width:0px;
}

Notice how the fi rst line of our style sheet refers both ms-vh and ms-vb, with a comma
separating them. This allows us to specify the font face in one place rather than needing
to enter it separately into each class. Grouping styles in this way not only saves time
when creating our site but also makes the site more easily maintainable when we and
other people make changes in the future.

If you are eagle-eyed, you will also notice that the color references (e.g. #903) only have
three digits rather than six. This is possible when a color has repeating numbers (e.g. 99
or 00), allowing us to condense #990033 to #903.

If you are not familiar with using CSS, do not be put off using it because it is easy to
learn. We also get a helping hand, because when we type code into the style sheet,
SharePoint Designer uses IntelliSense to suggest code we may like to use.

Once we have saved our style sheet, SharePoint Designer instantly refl ects changes to
the style sheet in the Design view of products.aspx.

When creating our td.ms-vb style, we specifi ed that dashed lines should appear below
each cell. By default, SharePoint Designer has a default value of 0 for our borders,
meaning that they will not display. In order for the dotted lines to appear, we will need to
make sure that our table has a border value of 1. We can do this by highlighting the
whole table and typing 1 into the border attribute in our Tag Properties task pane.
Selecting ourtable as the class for the table in this task pane will remove the solid border,
allowing our dashed lines to be visible in all their glory.
W e can take our formatting even further and use CSS to format the delete and insert text
links so they look like buttons, by giving them a border and some padding. We can also
give our "buttons" a different background color whenever the cursor is positioned over
them.

To add this additional formatting, we will place the following code into our style sheet:

a:link, a:visited, a:active {


color:#903;
padding-top:1px;
padding-bottom:1px;
border-color:#903;
border-width:1px;
border-style:solid;
text-decoration:none;
}
a:hover {
background-color:#EEE;
}

A word of warning about specifying these styles for your links—they will apply to all
links in the share site (and it is unlikely that you would want to do that). It would be
better for us to create a new class (e.g A.funkyButton) that we can use whenever we want
to render our links to look like buttons.
Conditional Formatting

We can make our data views more meaningful by setting up our data view to
automatically use different styles in response to differing data values. This technique is
known as conditional formatting.

Applying conditional formatting in SharePoint Designer requires us to use the XPath


language. Don't worry though because SharePoint Designer makes this easy for us.

We would like to apply some conditional formatting to our data view so that it shows a
differently formatted price for all wines that have a low number in stock.

We start this process by right-clicking on our data view and selecting Conditional
Formatting from the shortcut menu. This will open up the Conditional Formatting task
pane.

We then click on the data value that we would like to apply our conditional formatting to.
We will select any of the prices in the data form. Below, I have selected the price of the
most expensive wine, Chateau le Gay.

We then click the Create button in our Conditional Formatting task pane and select Apply
Formatting.

Doing so presents us with the Condition Criteria dialog box. This dialog is used to
specify the conditions for our formatting. To begin using the dialog, we click on the line
that says Click here to add a new clause…. We would like our Price to be formatted
differently if the number of products in stock is less than 10, and so select the options in
the diagram below and then click OK:

Now that we have chosen our criteria, the next screen allows us to specify the style that
will be automatically applied to our Price when the condition is met. In the Font category,
we will select a font-weight of bold, and in the Background category, we will select a
nice bright background-color of yellow (#FFFF00). This vivid style will ensure that the
information stands out to the users of the site.

To mod ify the condition at a later date, we can click on the condition in our Conditional
Formatting task pane and select Edit condition… from the drop-down list.

Fig 8

It is also worth noting that it is also possible to use conditional formatting to change the
visibility of the data so that it can be displayed or hidden, depending on the value. This is
useful to show or hide images. For example, if the type of wine is red, show a red bottle.
If white, show a white bottle.

Formatting Numbers

It is w orth pointing out that it is very easy to format numbers in our data view so that
they display as we would like. We can display our numbers as percentages or as a
currency and specify the number of decimal places that the number should have. We can
also control the 1000 separator so that commas appear in the correct places to make large
numbers more easily readable.

We will take the opportunity to display our prices with a dollar sign in front of them by
doing the following:

1. Rig ht-click on one of the prices in our data view.


2. Select Format Item as.
3. Select Currency.
4. This will open the Format Number dialog. Ensure that the Symbol is set to $.
5. Click OK.

Notice that we only needed to select one record and that all prices were formatted in the
same manner.

Filtering Data

It is p ossible to fi lter our data view so that only certain records are displayed. We will
use this functionality to display only products with a price of over $15. This feature
works in a similar manner to the conditional formatting (albeit there is no formatting to
be applied). To fi lter our data view, we follow these steps:

1. Right-click on our data view.


2. Select Show Common Control Tasks.
3. Select Filter: from the list.
4. Click on the fi rst row to add our new clause.
5. Specify the following values:
a. Field Name = Price (Number)
b. Comparison = Greater Than
c. Value = 15
6. Click OK.

You will notice that our data view now only displays the products that are priced over
$15.

To remove the fi ltering, we follow the fi rst three steps so that the Filter Criteria dialog
appears again. We remove our criteria by right-clicking on the black arrow to the left of
the criteria and selecting Remove. Finally, we click OK.

Using Formulae

When us ing SharePoint Designer, it should be remembered that it is a fully-fl edged


member of the Microsoft Offi ce suite of products. As such, we can use it to perform
powerful calculations that you would expect other products in the suite (such as Excel) to
perform.
We will add a new column to our data view that will display the total value of the wine
the Wine Company has in stock. We begin this process by clicking on our data view to
select it and then going to Data View | Edit Columns….

The Edit Columns dialog allows us to select the fi elds in our data set that we would like
to include in our data view. If we would like to add columns to or remove columns from
our data view, this is the dialog that we would use.

The dialog also allows us to add a formula column. We will do this now by clicking on
Add Formula Column… and then clicking on the Add >> button.

The XPat h Expression Builder then appears. If you have previously created formulae in
Microsoft Excel or Microsoft Access, then you will be familiar with the principle behind
creating formulae using a builder like this.

We can either type our fi eld names into the pane titled Edit the XPath expression or drag
them across from the fi eld list in the left pane. We can also use my personal favorite
method and double-click them across. Whenever we type a space into the expression
pane, IntelliSense suggests appropriate code items including fi eld names and arithmetic
operators (such as +, -, /, and *).

We will use the following simple expression:


Price * InStock

The following image shows the Expression Builder in use:


Once we c lick the OK button, SharePoint Designer adds our formula to our Displayed
Columns list as Formula 1 (important note: this has nothing to do with fast racing cars!).
When we click the next OK button on the Edit Columns dialog, our formula is added as a
new column on the right of our data view. You may wish to take a moment to resize the
width of your data view to 450 pixels and to rename the last column Total Value.

Sorting Data

Hopefully, by now you are impressed with how easy it is to display data using SharePoint
Designer. When it comes to ordering our data, you will continue to be impressed.

We would like to sort our wines so that the cheapest wines appear fi rst and the more
costly bottles appear last. To do this, we use the sort feature:

1. Right- click on our data view.


2. Select Show Common Control Tasks.
3. Select Sort and Group: from the list.
4. Click on the Price(Number) fi eld and click Add>>.
5. Click on the ProductName fi eld and click Add>>.
6. Click OK.
It is worth noting that we can also group similar items together within the data view. For
example, if our data specifi ed whether the wine was red, white, or rosé, then we would
be able to group the data by type.

Allowing Users to Sort the Data

It is easy for us to give users the ability to sort the records in the data view. We can
enable this sorting like so:

1. Click on our data view to select it.


2. Go to Data View | Change Layout.
3. Click on the General tab.
4. Check the Enable sorting and fi ltering on column headers checkbox.
5. Click OK.

Once we have saved the page, users will be able to click on the column headings to sort
the records by alphabetical order (or numerical order, provided that the data in that
column are numerical values).

Paging

Although ou r example data only contains fi ve different products, there are a huge
number of wine products in the market (there are about 6,000 wineries in the United
States alone). Naturally, we would not want to display tens of thousands of products all
on one page. By using paging, we can specify the maximum number of records that will
be displayed in our data view at one time. Depending on the options we have specifi ed,
users may be able to click forwards and backwards through the data view, displaying the
next records each time they do so.

1. Right-click on our data view.


2. Select Show Common Control Tasks.
3. Select Paging: from the list.
4. Click on the Display items in sets of this size: radio button.
5. Enter 4 into the fi eld.
6. Click OK.

Summary

Over the course of the last two chapters, we have discovered how easy it is to interrogate
a whole range of data sources and display information from them in our SharePoint site
in an attractive and useful manner.

1) 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

2) 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.

3) What is the GAC?

The GAC stands for the global assembly cache. It is the machine wide code cache which
will give custom binaries place into the full trust code group for SharePoint. Certain
SharePoint assets, such as Feature Receivers need full trust to run correctly, and therefore
are put into the GAC. You should always try to avoid deployment to the GAC as much as
possible since it will possibly allow development code to do more than it was intended to
do.

4) What is strong naming (signing) a WebPart assembly file mean?

Signing an assembly with a strong name (a.k.a strong naming) uses a cryptographic key
pair that gives a unique identity to a component that is being built. This identity can then
be referred throughout the rest of the environment. In order to install assemblies into the
GAC, they must be strongly named. After signing, the binary will have a public key
token identifier which can be use to register the component in various other places on the
server.

5) What are safe controls, and what type of information, is placed in that element in
a SharePoint web.config file?

When you deploy a WebPart to SharePoint, you must first make it as a safe control to use
within SharePoint in the web.config file. Entries made in the safe controls element of
SharePoint are encountered by the SharePointHandler object and will be loaded in the
SharePoint environment properly, those not will not be loaded and will throw an error.

In the generic safe control entry (this is general, there could be more), there is generally
the Assembly name, the namespace, the public key token numeric, the typename, and the
safe declaration (whether it is safe or not). There are other optional elements.
6) What is the CreateChildControls() method? How can you use it to do something
simple like displaying a Label control?

The CreateChildControls method in WebParts is used to notify the WebPart that there are
children controls that should be output for rendering. Basically, it will add any child
ASP.NET controls that are called instantiating each control with its relevant properties
set, wire any relevant event handlers to the control, etc. Then the add method of the
control class will add the control to the controls collection. In the relevant WebPart
render method, the EnsureChildControls method can be called (or set to false if no child
controls should be called) to ensure that the CreateChildControls method is run. When
using CreateChildControls it implies that your WebPart contains a composition of child
controls.

In order to create something like a label control in Create, you would create a new label
control using the new keyword, set the various properties of the control like Visible=True
and ForeColor = Color.Red, and then use Controls.Add(myLabelControl) to add the
control to the controls collection. Then you can declare EnsureChildControls in the
Render method of the WebPart.

7) What does the RenderContents method do in an ASP.NET 2.0 WebPart?

The render contents method will render the WebPart content to the writer, usually an
HtmlTextWriter since WebParts will output to an HTML stream. RenderContents is used
to tell how the controls that are going to be displayed in the WebPart should be rendered
on the page.

*** Side Question: I got asked what the difference between CreateChildControls and the
RenderContents method. The CreateChildControls method is used to add controls to the
WebPart, and the RenderContents method is used to tell the page framework how to
render the control into HTML to display on a page.

8) 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.”

*** Side Question: I got asked how many WebPartManager controls should be on a
page. In order to have WebParts on a page there has to be just one WebPartManager
control to manage all the WebParts on the page.

9) 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 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.

10) How would you go about getting a reference to a site?

PLAIN TEXT
C#:

1. oSPSite = new SPSite("http:/server");


2.
3. oSPWeb = oSPSite.OpenWeb();

11) 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.

12) 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.

Side Question: I got asked if there are other ways to send emails from SharePoint. The
answer is yes, there is. You can use the SendMail method from the SPutility class to send
simple emails, however it is not as robust as using the System.Net.Mail functionality
since it doesn’t allow things like setting priorities on the email.

13) How do you connect (reference) to a SharePoint list, and how do you insert a
new List Item?

PLAIN TEXT
C#:

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


2. {
3. using(SPWeb myWeb = mySite.OpenWeb())
4. {
5. SPList interviewList = myWeb.Lists["listtoinsert"];
6. SPListItem newItem = interviewList.Items.Add();
7.
8. newItem["interview"] = "interview";
9. newItem.Update();
10. }
11. }

14) 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?

PLAIN TEXT
C#:

1. SPList interviewList = myWeb.Lists["listtoiterate"];


2. foreach (SPListItem interview in interviewList)
3. {
4. // Do Something
5. }

15) 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.

16) 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.

*** Side Question: I got asked when you should state the credentials in code. You must
state the credentials you are going to pass to the web service before you call any of the
methods of the web service, otherwise the call will fail.

17) 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.
18) 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.

19) What is the IDesignTimeHtmlProvider interface, and when can you use it in
WebParts?

The IDesignTimeHtmlProvider interface uses the function GetDesignTimeHtml() which


can contain your relevant render methods. It was helpful to use in 2003 since it allowed
your WebPart to have a preview while a page was edited in FrontPage with the Webpart
on it, because the GetDesignTimeHtml() method contains the HTML for the designer to
render.

20) 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.

21) 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.

22) 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.

23) 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

Just to name a few things…

24) 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 fiel.

25) What file does a SharePoint solution package use to orchestrate (describe) its
packaged contents?

The solution Manifest.XML file.


26) 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.

27) 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.

Side Question: I got asked how the introduction of features has changed the concept of
site definitions. SharePoint features are important when understanding the architecture of
site definitions, since the ONET.XML file has been vastly truncated since it has several
feature stapled on it.

28) What types of SharePoint assets can be deployed with a SharePoint feature?

Features can do a lot. For example, you could deploy

Simple site customizations

Custom site navigation

WebParts

pages

list types

list instances

event handlers

workflows

custom actions
just to name a few….

29) 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.

30) 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.

31) 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.

32) 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.

33) 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.

34) How could you append a string to the title of a site when it is provisioned?

In the OnActivated event:

PLAIN TEXT
C#:

1. SPWeb site = siteCollection.RootWeb;


2. site.Title += "interview";
3. site.Update();

35) Can an event receiver be deployed through a SharePoint feature?


Yes.

36) 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.

37) 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.

38) 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.

39) 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.

40) 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.

41) 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.

42) 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.

43) 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.

44) 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.

45) 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.

Moss 2007 interview questions


Posted on July 2, 2009 by Dot Net Solutions

How to add a dropdown in the Master page.


• How to add BDC file to MOSS
• How to configure outlook to MOSS
• Can we edit master page through c# code
• How to publish infopath to moss through infopath interface
• Excel services
• What is extension of BDC file
• What is application definition file
• Can we add webpart to master page
• How to edit moss site through sharepoint designer
• What are the difference b/w system.web.ui.webcontrols.webparts and
Microsoft.sharepoint.webpart pages
• Custom webpart development
• Custom workflow development
• Content type
• Site column
• Site template
• How content type is related to page layout
• How to attach a content type to document library
• If moss have 10 content types how to map 2 content types to document library
• Target audience in document library
• How to show document title names in web part which are checked
• How can we get user name in webpart
• How to install search
• Can we search for Pdf file in moss
• How content database will work
• BDC navigation
• Site collection
• What is SSP
• Database in web application
• Where will be stored user images in moss
• What is web part communication
• How search index will work in moss 2007
• Custom search in moss 2007
• What is diff b/w spsite and spweb
• What is the class name to get site permissions in object model
• What is the class name to get list details in moss 2007
• BDC xml parameters
• Can we get subsites from spweb
• Web application path in local system
• What are the methods used in custom webpart
• How to deploy custom webpart and what are the diff methods
• What is spquery in object model
• What is “Filter description” in BDC xml file
• What is search crawl in moss 2007
• Can we develop a custom webpart without render method
• What is the use of SPFeatureReceiver
• What is IDEnumerator
• How to add .aspx pages to moss
• How to avoid loading all js files and css files in client side when we are using custom
css
• How to deploy a web part in server when the application is in client place
• We have 100 lists in server ,how can we categorise those list according to category
• How can we get diff types of languages according to the login place

How search index will work in MOSS 2007


Custom search in MOSS 2007
what is diff b/w spsite and spweb
Ans) SpSite is the root site(Root site+Subsites)
Spweb is particular site.

SPList is related to all the list to a SITE

what is the class name to get site permissions in Object Model.


what is the class name to get LIST details in MOSS2007

BDC XML parameters….

Can i get sub sites fom spWeb ans)No


Tell me webapplication path in local system
Tell me methods which r used in custom webpart.
How to deploy costom webpart and what r the diff methods.

What is SPquery in Object Model

What is “FilterDescriptor” in BDC XML file.


Ans)In this section Define the filters supported by the back-end method (or sql query)
here

Site Defination and site template

Abstract Class and Interface

what is search crawl MOSS 2007

Can i develop a Custom webpart with out Render Method?

what is the use of SPFeatureReceiver

IDEnumerator:
To enable Business Data Search, you must define a SpecificFinder and a special type of
MethodInstance method called IDEnumerator in your metadata

what is the refernce name space for data types (base class for data types)
what is deligates and types
what r diff b/w sql 2000 and 2005
how to catch exceptions in sql
what is session and how can we trace in .net
Session types
what is the array and arraylist
what is the diff b.w value type and reference type
What is the serialization and advantage
What is the cookieless session
A)http://www.devx.com/tips/Tip/27427

Interface
Abstract Class
Partial Class
Sealed Class

What is the diff b/w function and Storedprocedure


ACID properties in SQL

what is webpart
steps to develop custom workflow
Name space to create custom workflow
microsoft.sharepoint.ddl—–path of this dll
what is workflow
types of workflow
what r the default workflows
How to add microsoft.sharepoint.ddl to Application
How to deploy a workflow in server (Steps)

How to call another server table tr current server in sql


what r the new features in sql 2005
What is the trigger and types
what is the cluster and non-cluster
What is the diff b/w html control and server control
How can i call server control in Javascript
How can i convert html control to server control
what the advantages of server controls insted of html controls

what is GC pattern
Diff b/w structure and class
what is interface and advantage
Object model coding
ref value and out value
site template and site defination
working with web services in MOSS

The SharePoint 2007 Architecture.

CAML, Features, Custom Actions, and Application Pages.


List Types.

Form-Rendering Controls.

Field Types.
Site Columns and Site Content Types.
Site Definitions and Site Provisioning Providers.

Advanced SharePoint Programming.

Event Receivers.

SharePoint Web Parts.

Code Access Security (CAS).

Deployment.

Business Data Catalog.

1.How to deploy webparts in sharepoint application using script.


2.What is content Type
3.Difference between WSS and MOSS
4.How to configure events in sharepoint site
5.which server farm you people are using
6.How do you use BDC in your application
7.Explain architecture of your project.
8.what are the softwares do you need for installation
9.Is it compulsary to install microsoft office
8.Different types of templates in moss
9.Can you create more than one ssp site
10.what is the use of ssp
11.how do you implement workflows in your sharepoint site
12.Did you use sharepoint designer for customizing templates
13.if user profiles are exist in oracle database then which authentication did u use for that
site.

How search index will work in MOSS 2007


Custom search in MOSS 2007
what is diff b/w spsite and spweb
Ans) SpSite is the root site(Root site+Subsites)
Spweb is particular site.

SPList is related to all the list to a SITE

what is the class name to get site permissions in Object Model.


what is the class name to get LIST details in MOSS2007
BDC XML parameters….
Can i get sub sites fom spWeb ans)No
Tell me webapplication path in local system
Tell me methods which r used in custom webpart.
How to deploy costom webpart and what r the diff methods.

What is SPquery in Object Model

What is “FilterDescriptor” in BDC XML file.


Ans)In this section Define the filters supported by the back-end method (or sql query)
here

Site Defination and site template

Abstract Class and Interface

what is search crawl MOSS 2007

Can i develop a Custom webpart without Render Method?

what is the use of SPFeatureReceiver

****************************************
We can restore the sharepoint List/ Document library with content, the size of a template
cannot exceed 10485760 bytes.
***********************************
Workflows using workflow foundation
Customize Blogs, RSS Feeds etc
Search Scoped
Content Query web part
Advanced MOSS 2007 features
Business Intelligence
Business Data Catalog
Excel Services
InfoPath forms

NEW
What is a safe control configuration? To configure disk-based caching, which element in
web.config should be modified?
Please list the port numbers used by the Office Web Services in the MOSS Farm?
What is the base control that every SharePoint Field control is inherited from?
What is a safe control configuration? To configure disk-based caching, which element in
web.config should be modified?
List out shared services?
which type of datasources that can be integrated using Business Data Catalog in MOSS
How activate “feature” in MOSS
Please list the operations that are related to solution management in MOSS using
“stsadm”.
You are designing an Internet site http://www.mycompanysite.com/ using Web Content
Management features (WCM) of MOSS. Due to security requirements, all of the content
authoring is to be done only in the authoring farm (company intranet) using the WCM
features of MOSS at http://authoring.mycompanysite.com/. Can you promote content
from Authoring Farm to Internet Farm? If the answer is yes, what step should you do to
allow content deployment in the Internet Farm?

You are trying to develop a new Feature. However, on feature activation you want to
execute some custom code. What class should you inherit to achieve this? Can web parts
developed in ASP.NET 2.0 be used in WSS V3 web part pages?

In WSS version 3, IConsumer and IProvider interfaces are made obsolete. What alternate
interfaces are recommended to implement the above to achieve web part
communications?

To create a custom router for the Records Center in SharePoint, what interface and
method should you implement? You have developed a new feature called MyNewFeature
that depends on the “MyCustomFeature”. How do you specificy the dependency in the
MyNewFeature feature.xml?

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.

How to query from multiple lists ?


Use SPSiteDataQuery to fetch data from multiple lists

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.

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.

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.

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\”";

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.

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 content type defined at list scope

What are the ways to initiate the workflow ?


1. Automatic 2. Manual (standard WSS UI interface) 3. Manual (Custom UI Interface)

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.

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. a. 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) b. using Microsoft Office
InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone
WSS environment)

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#: SPSite
siteColl = SPContext.Current.Site; SPWeb site = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite ElevatedsiteColl =
new SPSite(siteColl.ID)) { using (SPWeb ElevatedSite =
ElevatedsiteColl.OpenWeb(site.ID)) { string SiteCollectionOwner =
ElevatedsiteColl.Owner.Name; string Visits = ElevatedsiteColl.Usage.Visits.ToString();
string RootAuditEntries =
ElevatedSite.RootFolder.Audit.GetEntries().Count.ToString(); } } });

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#: 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”; newItem.Update(); } }

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

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(“mmangaldas”);

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.

How Branding can be achieved by Master Pages? What are the advantages or
disadvantages of Master Pages?
Does sharepoint provide any way to grant read-only access to all the users of the
company on the portal?

What does the webpart .cab file include?

What are the different Back-up and Restore methodologies?

What are the steps to create a web-part?


What are the benefits of using Infopath?
What are the different namespaces per Sharepoint Object Model?
What are the steps in running a custom WebService under the context of SharePoint?

Which version of .NET Framework runtime is required to install Microsoft Office


SharePoint server 2007?

In MOSS Capacity Planning documents from Microsoft TechNet, a typical MOSS farm
represented as 4x1x1. What does 4 stand for in the representation 4 x 1 x 1?

List 2 out-of-box workflow types that are available in MOSS 2007. How do you turn on
Auditing for a SharePoint List?
Explain how to enable anonymous access to a SharePoint site?
What is Alternate Access Mapping? What does the “12 hive” mean in SharePoint?
Which SharePoint object and method is used to access a SharePoint List item?
Which control(s) should you inherit to create a web part for Windows SharePoint
Services v3?

How can you display content from one site in another under the same site collection ?
How to Create a custom list form?

Vous aimerez peut-être aussi