Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
53Activity
0 of .
Results for:
No results containing your search query
P. 1
sharepoint faqs

sharepoint faqs

Ratings:

4.5

(2)
|Views: 1,014 |Likes:
Published by api-3760773

More info:

Published by: api-3760773 on Oct 16, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

As promised, here are the answers to the SharePoint Developer Interview Questions that I posted last week. Some of the answers are long, some are really short, for the longer ones there might be too much content. The reason that there is a lot of content is because the answer can vary heavily from person to person. There is a concrete answer to all of these questions, and I have done my best to give you a general, albiet short, idea of what that is. There might be several answers, so don\u2019t take anything that I have written here to heart, and be sure to make your own decisions.

I wrote these answers in under an hour. If there are discrepancies, or spelling errors, just post the problem in the comments of the page and I will adjust the answers accordingly. If you would like to contribute to the list, do the same, and I will move your comment with credit to the post.

Note: A LOT of these questions are specific to SharePoint 2007, and won't have
applicability for SharePoint 2003!
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
exceptions 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 Web Parts 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 Class Resources 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 files 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 Web Parts 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 Fore Color = 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 Render Contents 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 Web Parts will output to an HTML stream. Render Contents 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

Render Contents method. The CreateChildControls method is used to add controls to the
WebPart, and the Render Contents 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 Web Parts (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 \u201cthe central class of the Web Part
Control Set.\u201d

*** Side Question: I got asked how many WebPartManager controls should be on a
page. In order to have Web Parts on a page there has to be just one WebPartManager
control to manage all the Web Parts 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 site and all
its sub sites]). The SPWeb object represents an instance SharePoint Web, and SPWeb
object contains things like the actual content. A SPSite object contains the various sub
sites and the information regarding them.

Activity (53)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Praveen Asthana liked this
ALi liked this
ameshlal liked this
seenuspark liked this
Nishant.kumarid liked this
karim2426 liked this
seenuspark liked this
Sienna2Sienna liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->