Windows SharePoint Services Products and Technologies blog by Harish Mathanan

Tuesday, April 21, 2009

A Simple Feedback Feature Part 3

Part 1 of showed you the beginning of a feature, by creating and defining a feature.xml file. Part 2 then showed you an element manifest file defining 3 different columns. We will now move on to Part 3. Here, we will create another file defining a new content type using the columns created in Part 2. So without further ado we shall begin.

Custom Content Type

From the folder within our project, add in a new XML file naming it as specified within your <ElementManifest>. In my case that would be CustomContentType.xml.

I then go ahead and define the content type.

contenttype

The above screenshot shows you how I defined a content type called “Feedback”. I would like to stress on 2 particular parts that is shown above.

Firstly, as with columns (fields) and the feature, an unique guid is assigned to the content type. Notice however that the length of the guid seems longer? Well, this is because the “Feedback” content type is inheriting from the Item base/parent content type. Which means, we would actually have to prefix the base type ID before the guid. MSDN has two different approaches for constructing a valid content type ID, and I tend to go with the second approach.

The second part that I would like to point out is the <FieldRefs>, as you can see in here I’ve defined the 3 columns created in Part 2 to be used with the “Feedback” content type. I did this by specifying the column (field) guid, name and display name as <FieldRef> individually.

Well, that’s it for Part 3, we now have a content type definition within our feature as well. In the next post, we will create a custom list that uses this content type.

A Simple Feedback Feature Part 2

If you’re reading this second part days apart, then you may want to take a quick look at Part 1. I’m writing them all at one go, but I’m breaking them into parts for readability and also allows me to take a break every now and then ;)

Well from part 1, I now have my Feature.xml file created. And under the <ElementManifests> part I’ve specified 3 different elements. They would basically reference other XML files that define specific elements and make up a feature. This post will show you how columns can be define within a feature.

Custom Columns

Within your project create a new folder giving it a meaningful name. I’ve just name my folder the same as my project, HeroesMode.Feedback.Feature

Now within the folder, add in a new XML file naming it as specified on your <ElementManifest>. In my case, it would be CustomColumns.xml.

I then go ahead and define my columns (fields).

customcolumn

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The screenshot above show my column (field) definitions. Basically, I’ve defined 3 different types of columns (fields). First one being a People Selector, then a Choice Menu and lastly Multiple Line text. Notice that there is a unique guid assigned to each column (field), and that they are within the curly braces {}.

Also notice that there is a property called Name and another DisplayName. Name here meaning the columns (field) internal name, and DisplayName is the name that will be visible to users on the Site Collection.

Now, as you can see the feature is taking shape. My next part would be defining a content type that will utilise these 3 columns (fields).

A Simple Feedback Feature Part 1

The purpose of this post it to demonstrate how we can utilise features for creating custom columns, content types and list. I would also then use feature receiver to create/delete a list depending on the function performed.

We all probably already know what a feature is, and how it has enhanced SharePoint custom deployments. To me, a feature is basically a collection of files, code and resources that is installed and activated as a solution for a specific purpose.

Let me not waste more of your time and begin with Part 1.

Feature.xml

Begin by creating a new project in Visual Studio (I use VS 2008), and naming it something descriptive. I’ve named my project HeroesMode.Feedback.Feature

Then add in a new XML file naming it Feature.xml, and then begin defining your feature.

featurexml 

As you can see from the above screenshot, I’ve specified an unique guid fro the feature. I’ve also specifically set the scope of the feature to Site, this meaning the feature will be installed and be available at the Site Collection level.

I’ve also added in a title (a really obvious one at that!) and provided some text describing the feature. These two properties will be visible to users once a feature has been installed (eg: see pic below).

desc

For now, do not be too concerned about the <ElementManifests> part of the Feature.xml file. I will go through them individually in my upcoming posts.

Saturday, April 11, 2009

Error: is already routed to the Default zone of another application. Remove that mapping or use a different URL

This happened while trying to re-create a web application after it had been deleted. Looking around I found a few suggestions around this, but none of them would be something I would attempt. For example, one forum thread stated this:

“Open the object table, find an entry that has the same name as the site and delete the row. This worked for me.”

Seriously, I don’t care if that worked. I would never modify or update anything directly on the database. Let me repeat that, I would NEVER modify or update anything directly on the database. I assume most of you already know why, hence I will not be going into it.

Resolution then? Well, my non-suicidal work around was to get into Central Administration. On the Operations page, under Global Configuration click on Alternate Access Mapping (AAM).

You would probably see a list of entries, one being the very URL that caused the error with it’s zone set as Default.

Click on the URL, under the Internal URL column heading to get into the Edit Internal URL page. On the URL protocol, host and port field, append the URL there to something else. For example, I added in a suffix of 123.

url01

url02

Click on OK, now get back to re-creating the Web Application. You would have no errors now and the Web Application will get created as required.

To finish things off, get back into AAM. Click on the relevant URL again. And this time reverse the process. Append the URL protocol, host and port field by setting in back to the original URL. For example, I removed the 123 suffix from mine.

url02

url01 

Click on OK, and all done. Wishing all a very Happy Easter!

Friday, April 3, 2009

The following file(s) have been blocked by the administrator: /default.aspx.com

This is what I got when I tried to get into my WSS portal. Well, it actually happened after I installed Search Server Express 2008. All I did was install Search, and ran the configuration wizard, I hadn’t configured any search settings at the time. Strangely enough, after a while by trying again with a new browser I got it with no errors. My suspicion is that although it had completed the install, and finished with the wizard, it was still holding on to some stuff, needing time to settle itself in.

So if this happens to you, try not to panic. Give it some time, and try again. Good luck!.

Edited 08/04/2009: Spelling Corrections.

SQL Server Express 2008 Requirements

Planning to install SQL Server Express for your WSS environment? Well make sure you have these in place first:

  • .NET Framework 3.5 SP1 (3.5 by itself doesn’t cut it)
  • Windows Installer 4.5
  • Powershell (it will progress through install but throw an error when you set it up)

That’s it! hope this saves you some time and hassles.

Thursday, April 2, 2009

HRESULT: 0x80020009 (DISP_E_EXCEPTION))

What did I do to get this error? Well, I went to edit a page, and then selected Page Settings. That was it!

Needless to say, I spent some fair amount of time looking for an answer. It was quite comforting to know that I was not alone out there actually. Many others have come across this, and their suggestions vary greatly. For example:

  • Delete and re-create the site.
  • Check the Onet.xml file.
  • Check the xslt for your latest web part.

Unfortunately, no two answers were the same. It wasn’t soon after, I realised that I had actually been messing around with the Form Web Part. I’ve closed it now, but it would still be on the page.

My next step? Navigated into the Web Part Maintenance Page (see how). Believe it or not, I actually had tons of closed web parts listed out. Some were CQWP, some CEWP…well you get the picture. I selected and deleted all the web parts that weren’t being used and/or closed. Went back to my page and hit Ctrl + F5, then went back into edit mode and selected Page Settings. No funky error this time :)

It seems that although this error presents itself in a variety of ways, the common factor would be web parts. If you ever come across it, have a look at your web parts first.

Get to Web Part Maintenance Page?

This is probably known by many and I’m sure well documented. But personally, I keep forgetting how to get to the Web Part Maintenance Page. So to save myself the hassle of looking it up again, I’m noting it down here as a post.

Just add ?contents=1 to the end of your url.

Example:

 
Copyright Harish Mathanan 2008