Tuesday, June 24, 2008

Unable to add selected web part(s).

You know this error?

You just developed a new web part, all excited and ready to test it and wham!

Unable to add selected web part(s).
[Web Part Title]: One of the properties of the Web Part has an incorrect format. Windows SharePoint Services cannot deserialize the Web Part. Check the format of the properties and try again.

Well, this keeps happening to me (not the first time, and definitly not the last) so I thought I'd share one of the reasons for this message to appear.

This meesage can apear in various situations - so feel free to comment with your own "check list" for this error.

Reason 1:
Check your class definitions. In most cases - if you forget to mark it as "public class" you will get this error.

Reason 2:
Check your properties definitions. Could it be that custom logic in get/set throws and exception?

Reason 3:
Check your DWP/Webpart file. It may point to a property that does not exist (removed / spelling mistake), or the assembly is not registered correctly. Best way to troubleshoot this is: Go to your site collection settings, to web parts gallery, click "new" and add your web part to the gallery. Try the new DWP/Webpart file created - does it work?

Reason 4:
For Bin installations - make sure your DLL is in the bin folder of the current web application. Make sure it is registered as safe control in the web.config with no spelling mistakes.

Reason 5:
For GAC installations - make sure your DLL is in the GAC, if you changed it recently try an IISRESET. Also - Make sure it is registered as safe control in the web.config for each web application with no spelling mistaked.

Ok, this is what I can come up with now... Share your experience, this error can get pretty annoying!

Hope I helped save lifes on this (or at least, made the world a better place with less developers screaming in the middle of the night).

Brought to you as a public service by Shai, KWizCom :)

Wednesday, June 18, 2008

How to improve SEO of you WCM sites

Well, as many of you might know - the most important thing for an internet facing web site is to be found easily in the leading search engines.

Because it does not matter how nice and sexy you "pimped" your web site, nor how relevant and profound is the content - if no one can find it your web site is as good as dead.


Ok, so you will be happy to learn that WCM (Web content management) sites that are created in SharePoint 2007 are pretty SEO-aware (Search Engine Optimization), and this comes a long way for you.


Some key features you enjoy with no hard work:


* Navigation, is configured OOTB (Out Of The Box) to reach all pages, expose them to the search bot / spider / what-you-might-call-it. All links are true a href links, no scripts.
* Zero to none use of hidden frames (only place you'll find them is in authoring mode
* Caching support and special attention for anonymous users (used by the search engines)


And much much more...



But - we are here to see what can we do to make it even better? How can I improve my site SEO?



Well, from a little research I did for a customer of mine while back we found 3 things that are actually can improve our SEO greatly.
(Important: I and not teaching how to cheat search engines! This is very dangerouse to play with. Simply how to make your site friendlier to search engines. You still have to have good content, incoming links and such to get good ratings on your site)



1: Turning off the view state.
2: Adding a site map for google.
3: Adding meta-tags for keywords and description for relevant content pages (advanced)

Ok, so let's go over these options and see what is the benefit and how it can be achieved:


Turning off the view state


What is gained?


If you right click->view source on any content page in MOSS you will see right at the beginning of the body tag you will see a input type hidden tag with id=__VIEWSTATE... then, its value will pretty much take your entire page so you'll have to scroll down several times...

So, apparently this gigantic piece of information is something that most search engines do not like to say the least. Especially when it comes before you true content of the page - it ruins your content rating in the search results!

Another obvious reason is, your page is larger... and larger pages are slower to load, and search engines will mark your page as a slower page... we don't want that.

How is it done?


Removing the view state from your WCM web application is rather easy. Simply go to your web application root directory (usually smth like: c:\inetpub\wwwroot\wss\xxxx),backup web.config file, and open it for edit in notepad. Look for enableViewState="true" and change it to false.

No need for IISRESET, but you site will experience a very small delay on the next request.

Adding a site map for google.

What is gained?

When a search engine (google in my example) starts indexing a web site it first of all checks to see if someone had prepared a "work order" for him. This "work-order" is what we call a sitemap / site map XML file that will allow us to make special requests for the crawler when it is working on our site.

If we do not have such a sitemap file, the engine will just open the home page of our web site and start crawling all links it can find on it for sub pages and so on and so forth...

This is usually good enough, except for cases where:

We want to have a section in our site that is not exposed by a link at the top site. Like http://www.kwizcom.com/ will not show a link to www.kwizcom.com/support (only example) which will hold our products support forum.

In this case - with no site map, our /support site will not be available at google at all.

Another problem we can prevent using a site map file is, when you have the same content in 3 different pages on your web site. 1 at the home page, and twice at the specific product information pages... Google will think you keep duplicate content and will lower your web site rank!

Using a sitemap, you can choose specifically what pages you want google to crawl, what pages are more important than others and what pages you don't want him to load.

One last benefit you gain by using a site map is that you can tell the engine what is the lifespan of each of your pages. Meaning: how often does its content change - monthly? weekly? so google will be sure to check it up every once in a while and update its content. Cool, eh?

How is it done?

Well, building a site map for MOSS (or any site for that matter) can of course be done manually, but you have to keep in mind that we are talking about a lot of pages to add to the XML files and this can be very time consuming!

Furthermore, you have to rebuild your site map every once in a while to reflect changes, additions and deletions...

You can develop a utility that does that for you, or use our site map builder here:

http://www.kwizcom.com/ProductPage.asp?ProductID=737&ProductSubNodeID=738

Once you got your hands on a site map generator, your work is just starting:

You will need to make changes in the XML to hide pages you don't want to show, change rating for more important pages and customize other information on it to match your requirements.

Adding meta-tags for keywords and description for relevant content pages (advanced)


What is gained?

By adding a meta tags of keywords and description to your pages you will let the search engine what content is your web site or web page targets.

This helps to raise the quality of the content in your web site. You may want to add specific keywords /description to all pages, and allow some pages to have additional information added to them.

How is it done?

Doing this can be very simple or very complex depends on your needs...

In the most simple straigh forward way - just edit your web site's master page and add the meta tags for keywords + description to the HTML head node like so:

<meta name="Description" content="KWizCom, knowledge worker components">

<meta name="Keywords" content="buy web parts, products, sharepoint, wss, moss">

But, if you requier your content to be changed according to the information of the current page (let's say you wish the page's title to go in to the description along with the site's name, and you have a metadata field named: keywords you wish to be loaded into the keywords tag), things get a little tricky.

But not to fear! I have created a control that will allow you to plant it in the master page and define what exactly you wish to see in these meta tags... it's just that using it is a bit tricky, so for now I don't have time to elaborate. But if you want it anyway before I manage to write a post about it - write me to shai at kwizcom.com and I will send it to you and try to help you configure it.



Ok, that concludes my post so far... it's been a very long while since I posted here, just in case you wondered - I relocated myself to Thornhill ON and didn't have enough time for nothing...

Hope this helps some of you,

Thanks,

Shai Petel

Specifying the web part you need to your developers

Hi All As a part of a SharePoint solution analysis and specifications work, a system analysts has to specify various web parts that need to be developed. When specifying a web part, we should keep in mind some important features that should be clearly defined to the implementing developer:
web part properties - A web part may have a set of dynamic properties that can be configured in run-time by a site administrator. When you specify a web part's requirements you must not forget to define its dynamic behavior - all properties that you wish that a site admin will be able to configure (this actually what makes the web part dynamic).
web part connections - SharePoint (WSS/MOSS) provides a framework which enables web parts to communicate and pass values from one to another in run-time. This framework is called "web part connection framework". This framework defined a standard for any web part to send/receive values from/to other web parts. This way choosing some value for example in one web part, can filter the displayed values in another web part. When you specify a custom web part, don't forget to define the connections that this web part should support.
Standard GUI - SharePoint has a large set of defined styles. Obviously, if your new web part will be displayed inside some portal, you would like it to have the same styles as all other web part on the page. Further more, if a site administrator changes the site's theme (the overall schema of fonts/ colors etc), you will want it to apply also to your custom web part. This means that the web part should be implemented using these standard SharePoint styles and NOT some propriaty styles.

I have created a short web part specifications document to be used as a basic template for defining a custom developed web part.
Download the web part specifications document:
http://www.kwizcom.com/
Click "Specification documents for SharePoint solutions" item in the "KWizCom News" scroller.

Nimrod
http://www.kwizcom.com/