Caveats of Protecting Your SharePoint Environment with Microsoft Data Protection Manager

* This article was written in the context of System Center Data Protection Manager 2006 (SCDPM), a technology now considered deprecated with the introduction of System Center Data Protection Manager 2007. Variations may exist. *
 
Caveats of Protecting Your SharePoint Environment with Microsoft Data Protection Manager 
There are certain caveats that exist when using Microsoft Data Protection Manager within your SharePoint environment that have to be taken into consideration when planning your deployment and disaster recovery strategy. These caveats are very important when considering the impact that they might have on your enterprise environment and disaster recovery.
 
 
The Largest Caveat
The largest caveat that exists with a marriage of DPM and SharePoint is support for SQL backups (minus using the backup feature to export and flat file exportation) is not currently supported. This feature is planned to be built in the second half of 2007. 
 
 
Hardware Requirements for Microsoft Data Protection Manager
Firstly, you have to look at the actual server itself that you are using as your DPM environment. Running DPM requires using Windows Server 2003 with at the very least SP1 applied, and because you will require two volumes for DPM to function correctly you will need to have two different hardrives.  If you attempt to install DPM on a server with only one harddrive, you will get an exception thrown during the setup dialog. You can optionally add this volume at a later date. The reason that there are two harddrives required is the first will be the OS and relevant DPM program files, and the second will be used for data backups, and nothing else. Putting other program files on the second harddrive could possibly cause the DPM server to crash. Make sure that you also meet over the hardware requirements as well. Allocate at least:
  1. A 2 GHz or faster processor
  2. 2 GB of RAM
  3. 3 times the harddrive space as the estimated protected data
These are over the Microsoft recommendations, however when backing up SharePoint farms it can be a rather resource intensive process and therefore is better to plan over estimations that are more tailored to environments where DPM is mainly used as a file share backup mechanism. As well, SharePoint typically will increase the amount of data stored within its repositories dramatically from initial implementation to full production use by organizational virtual teams, and will only get larger as time progresses and more users adopt to using it. Multiplying your estimates by three is a guess, and the amount of disk space that you use should be on a company by company basis. 
 
Constantly Changing Data In Exported Backup Files
Remember that similar to SharePoint, Data Protection Manager will keep different revisions of its backups. Content housed within SharePoint is changed extremely frequently, since initial document creation can be housed there through an arbitrary amount of changes with an arbitrary amount parties involved. This can be from a single to a triple digit number depending on the nature of the documentation or object. One must plan accordingly with this in mind. Although DPM will only keep revision of the changes, it still can be a large amount when considering the environment we are tailoring DPM for is SharePoint. 
 
Ensuring Server Compliance Requirements for Data Protection Manager
Secondly, you have to look at the servers that you have available to assimilate into your DPM environment. Within a SharePoint environment, it is fairly atypical to have any other servers other than Windows Server 2003 running, however with some networks there are often other versions of servers such as Windows Server 2000. If you are using a Windows 2000 machine for your data storage, you should firstly install Service Pack 4. If you have other breeds of servers within your environment such as Unix and Linux, these servers are obviously not supported as data stored for DPM as well, as well, you can’t deploy agents to these servers since they won’t be compatible with the executables.
 
For Fresh Windows Server 2003 Installations 
Once you have Windows 2003 installed, it will bring up an .hta file which will allow you to configure server roles. Role implementation can also be launched by selecting the manage server roles selection out of the program files menu, or can be manually configured using the add/remove program dialog. You can configure the server with any role you choose besides a domain controller. Since the server will be querying other servers within the environment for disk-to-disk backups, it must be a member of the domain that your SharePoint server and SQL cluster reside on. It is not wise to put other software on this server as well, try to keep it as built down as possible so as not to interfere with other DPM processes.
 
Say No to Encryption with DPM
With SharePoint, the files that we are mostly concerned with protecting will be the exported SQL backup files and SharePoint file stores. There are some file types that are impossible for DPM to backup however, most notably those that are already encrypted, such as documents encrypted with PGP or other relevant encryption engines. When doing system restores of your SharePoint servers, there are other assets that will not stored within the backup, such as:
  • Paging Files
  • The Recycle Bin
  • Volume Information Folder
With SharePoint, there is typically not an end-to-end encryption solution in place because storing encrypted document within SharePoint repositories will confuse the gatherer and searching since it can’t correctly flag the data within the document. An end-to-end encryption solution for SharePoint that carries the encryption cipher is a piece of software currently being developed at ARB Security Solutions.
With the default package of DPM, there are the possibilities of using three different agents, for three different servers, purchasing more agents is relatively inexpensive if you need to protect more assets within your environment.
Share

Redirector WebPart SP Solution File Download

So, I am making available to the public the Redirector SharePoint WebPart that I wrote for a buddy who works at a fairly large financial firm (read this post for the complete story on that mess), it’s not very fancy, and the functionality that it introduces into a SharePoint is relatively simple in purpose. I had talked about it before in this post, but only had released the WebPart assembly and not the actual SharePoint solution file which is pretty significant for getting the thing off the ground in your environment.The code itself I will most likely look at optimizing /refactoring at a later date, but for the time being the functionality is there and you can put it to use (as always, I would recommend that you test the WebPart in a staging or development environment before you push it to production). Anyways, it’s free and you can use it at your own discretion, there is no license limit that is placed on it etc. (as with everything distributed on this site), and it is distributed via a SharePoint solution file (.wsp).

To install the WebPart is relatively straightforward, and requires working the SharePoint solution and SharePoint Feature functionality. If desired, a majority of this could just be put into a .bat file. Let’s firstly look at how to deploy the WebPart, and then we can go about examining the business requirement target and why one would possibly use the Redirector WebPart. I think its easier to talk about once you see it actually deployed.

The first thing that you must do is navigate to the directory where STSADM is located. Generally this is in the C: directory.

[code]

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

[/code]

Once you see that you can get access to STSADM, you can start to trip the relevant operations. The first thing that you should do is to add the solution file to the SharePoint solution store using the addsolution command.

[code]

stsadm -o addsolution -filename RedirectorWebPart.wsp

[/code]

Following, execute the timer job. This is necessary if the administrative service is not enabled, as the timer job will be created however it will not be put to work.

[code]

stsadm -o execadmsvcjobs

[/code]

Now that the solution file is installed, you must deploy the solutions to the relevant web applications. You will notice some interesting switches during this process, mainly that we are deploying it immediately as opposed to scheduling a time (as you see through the SharePoint UI fairly frequently), that we are allowing Code Access Security policies (so that the WebPart can be run from the bin directory as opposed to the GAC which would otherwise post a security risk), and the deployment target is fairly vast.

[code]

stsadm -o deploysolution -name RedirectorWebPart.wsp -immediate -allowCasPolicies -allcontenturls

[/code]

As before, we are going to force the timer jobs to execute following all at once so are changes take effect immediately.

[code]

stsadm -o execadmsvcjobs

[/code]

Lastly, we must active the feature that the Redirector WebPart is dependent on. This is accomplished using the activatefeature command. Once the feature has become activated, you will be able to use the WebPart in the relevant site that you wish.

[code]

stsadm -o activatefeature -name RedirectorWebPart -url

[/code]

Now that you have the WebPart deployed, I guess I should explain what the hell the WebPart does. The business problem that the Redirector WebPart looks to solve is very, very simple in purpose. Often times information workers find transversing a large SharePoint instance difficult, an issue that gets even more complex and convoluted when your MOSS instance becomes an enterprise EIM (Enterprise Information Management) system that becomes an intrinsic part of your and your user’s arbitrary business operations. Generally, one of the most difficult tasks that you encounter when you roll out SharePoint is gathering appropriate end-user adoption of the collaborative technology, since often times finding the information that information workers want tends to be rather difficult since they are not used to the built-in SharePoint facilities. End-user adoption therefore implies meaning getting your users to their information that they want faster and more efficiently. This is a fairly basic principle of all knowledge management centric systems (for more information regarding formal knowledge management theory, you can view some of the research that I have done on the subject here for my course Applicable Knowledge Management in The Workspace at FSU.

Introduction to Knowledge Management Systems

Developing Knowledge Management Structure

Formation and Elicitation of Knowledge Management

Building Effective Communications Using Fitting Skills

Knowledge Management Schemes)

Some of it is brief explanations of past research (and researchers) into the subject, however I think that you will find that in concept it will demonstrate the overall architecture of a beneficial KM system and the intrinsic pieces that go into one).

The enterprise search features that are integrated into SharePoint are certainly one method that will get users to where they need to go and closer to the information that the desire in a large environment. However, in environments that instigate multiple site collections, usually the search scopes that are being used vary heavily since it is a site collection by site collection search configuration (which is a PITA). This by no means implies that the search features that SharePoint provides are not a powerful concept that should be exploited in your environment; rather, this is solely a supplement to those concepts albeit a large technology gap.

If there are multiple site collections in the SharePoint architecture / instance, it is common that the site collection holds a specific purpose. Meaning, some architects choose to divvy site collections based on organizational structure and role, such as specifying a site collection for each department, etc. or something similar. This can be any arbitrary purpose; however it tends to follow some sort of naming convention. Although most architects will argue this is not a beneficial architecture for an overall SharePoint strategy, it is relatively common in environments that don’t have the time / resources that need to be dedicated to study pre-existing business processes and tailor the SharePoint instance around those parameters accordingly. Since SharePoint has become an intranet platform for SME (Small to Medium Enterprises) in the Microsoft market they must be taken into consideration.

This is what the Redirector WebPart is assuming that you are doing, but this by no means implies that it requires site collections. You could use it just as effectively with sites. What it does is provide you a limited amount of automatic redirections (10 at the most, if you need more email me), that are based on a SharePoint profile property. For example, you could set the Master Profile Operator to Department (this is actual set as the default in the WebPart class constructor). Then, you could define several profile operators, such as Sales. When a user within their SharePoint profiles have the Department value set to Sales, you can redirect them (if the redirection condition is activated), to http://yoursharepointsite/sites/sales/default.aspx without them seeing the core site collection (you will see this in more detail later).

There are two modes of operations for the WebPart, one for administrators, and another for normal users. Administrators should not be immediately redirected, as they are responsible for maintenance of the root site as well as the configuration and management of the Redirector WebPart. Therefore, administrators are presented with a dashboard of all the current active redirections. Normal users that are not administrators however are instead redirected to whatever conditions are set in the WebPart properties. This is accomplished with a simple method that will trigger the check.

But what if the user doesn’t have anything set for the property in their profile? This is where the default redirection property comes into play. If the profile property returns as NOTFOUND then the user is redirected to whatever you place into the WebPart properties as the default redirection site. It is just a catch all to problems as they may occur.

You can also enable debugging within the WebPart properties. Simple debugging will display miscellaneous information under the WebPart, and if you want to email for help with the WebPart, I am going to ask you to send me this information so enable it first.

You can also manage the appearance of the administrative dashboard directly from the WebPart properties. The label properties (i.e. the string text) that appears throughout the WebPart can be customized to whatever you want, you aren’t limited to those that I have chosen (because I hate when WebParts have hard-coded strings personally, I think the complete appearance should always be manageable by the administrator at the very least, with just immutable methods).

So here is an example use case. I have one account, whose parameters are:

Username: Administrator

Role: SharePoint Farm / Core Site Collection Administrator

Then I have another John Doe account that works in the Sales department at my organization. Because the sales department generally will only use their specified site collection as opposed to having an interest in the other various business units site collections, it makes sense to just dump the users there.

Username: John Doe

Role : Reader Finance Site Collection

I am making these as just local accounts, as you can see:

I also have two site collections, one is the core site collection, and the other is the sales site collection. Ideally, when the John Doe user first enters the core site collection (since it is the URL that is distributed through all the internal marketing material), they should just be redirected to the sales site collection (or site, whatever your choice is).

As you can see, John Doe is a in the Members group of the sales site collection:

As I am logged in as the administrator, I am not redirected to any site collection, but instead presented with a dashboard view of all the configurations I have made previously. The first thing that I should look into doing is setting up the Global WebPart parameters which will contain things like the root site name (makes it easier to setup the redirections), and if I should have a default redirection instance setup in case none of my redirections are true for users (i.e. returns NOTFOUND).

All my global information is setup, and now I can configure the first redirection condition the WebPart will capture. Since John Doe is in the sales department, I am going to configure my first redirection so that it will look at the SharePoint Profile operator Department for the string Sales. If Department equals Sales then I want the user redirected to the sales site collection located at: /sites/sales/ as you can see in the following site collection creation screen (John Doe is a member of this site collection).

So my Redirection property should look like:

After this property is committed, you will see the Redirection Dashboard adjust so that you see that there is redirection condition that has been enabled. Within the dashboard, you are able to see the profile operator that is being looked up, the property that is being used for comparison, and what site the resulting match will end up with.

Within this condition activated as such, whenever John Doe comes into the friendly core site collection URL, he will be automatically dumped into the sales site collection.

Anyways, once you get to play with it, you will understand how it works. Feel free to email me if you have problems, or if you have suggestions for improvements. I am going to be focusing on my next WebPart project, so I might not be super responsive, but I am always up for improving past freeware WebParts. I will forward to developing more user interaction WebParts that help user adoption, so check back to sharepointsecurity.com and sharepointsecurity.com/blog frequently for updates (or subscribe to my RSS feeds if that is your cup of tea).

Download the SharePoint Solution (.wsp) file

Please read this if you want to know the legal policy of ARB Security Solutions Provided Freeware.

Share

SharePoint Developer Interview Questions – Answers

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’t 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 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?

[csharp]

oSPSite = new SPSite(“http:/server”);

oSPWeb = oSPSite.OpenWeb();

[/csharp]

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?

[csharp]
using(SPSite mySite = new SPSite(“yourserver”))
{
using(SPWeb myWeb = mySite.OpenWeb())
{
SPList interviewList = myWeb.Lists[“listtoinsert”];
SPListItem newItem = interviewList.Items.Add();

newItem[“interview”] = “interview”;
newItem.Update();
}
}

[/csharp]

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?

[csharp]
SPList interviewList = myWeb.Lists[“listtoiterate”];
foreach (SPListItem interview in interviewList)
{
// Do Something
}[/csharp]

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:

[csharp]

SPWeb site = siteCollection.RootWeb;
site.Title += “interview”;
site.Update();

[/csharp]

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.

Share