Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

8/17/2007

Resolving the "Unable to display this Web Part" problem after SharePoint Designer restore

If you've restored the SharePoint site using commands Site --> Administration --> Restore site and this site had special XSLT data views you may be in for a big surprise!

You can receive the following message:

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.

Or in Slovene language

Spletnega gradnika ni mogoče prikazati. Če želite odpraviti težavo, odprite spletno stran v urejevalniku HTML, združljivim s storitvami Windows SharePoint Services, kot je program Microsoft Office SharePoint Designer. Če težave ne morete odpraviti, se obrnite na skrbnika spletnega strežnika.

The problem is that while restoring the site, SharePoint designer doesn't correct the GUIDs of lists being used. For example: You're having an XSLT data view of a list called Contacts. When restoring SharePoint designer creates the list with a new GUID, but it uses the old GUID (from where the backup was made) of the list. The solution is simple: Fix the GUIDs of lists used in dataviews:

1. Open the Manage content administration page of your site (http://server/site/_layouts/mcontent.aspx)

2. Copy the shortcut of the list being used in XSLT to clipboard

3. In the URL you'll find the new GUID of a list between brackets ( in http://server/site/_layouts/ListEdit.aspx?List={89D731E5-0538-4999-B4AF-D7A5D9EA781F} the GUID is 89D731E5-0538-4999-B4AF-D7A5D9EA781F

4. With SharePoint Designer open the page with XSLT data view and search for term ListID in the code.

5. Select the value of the ListID parameter. It should be the GUID of the list (either in ListID="....." or in the same tag, look for GUID-like numbers.

6. Prest CTRL+H for Search and Replace with the value still selected. It will automatically populate the "Find what" field with it. Now paste the copied URL with GUID in the "Replace with" field and remove all but the GUID. Make sure you have the "Find in Source Code" option checked.

7. Now just press the "Replace all" button and your XSLT data view will magically come to life :).

I hope that this bug will be fixed with next version of SharePoint Designer, or maybe can develop some kind of plugin for that procedure to speed up the process for all the pages. I know that with FrontPage this wasn't happening.

8/14/2007

Access server different server with certain host name - build a new site while current still exists

The upgrade from Windows SharePoint Services 2.0 to 3.0 gave us in the company the opportunity to reconstruct some of the sites. The issue was that while the new site in WSS3 was in development, the site in the current server would stay active.

With version 2 this wouldn't be a problem. While having the existing www.site.com we'd create a new SharePoint site with the same host header and add a host header like new.site.com and work on it using new.site.com, while the DNS server is still pointing to the old site with www.site.com. At the end you just need to change dns for www.site.com.

The challenge comes with the version 3.0, because it's bound to host headers. Therefore it's best to work with the original host header from beginning. So how to build a website on a new server with a host header www.site.com while the other one still exists?

One alternative is already described in one of my previous posts.

The second alternative is to set up a DNS server to point to the new IP with the existing domain and use it like primary dns server on the development computer. Not practical - just to sacrifice the whole DNS server for one site.

My friend Miha - who in my oppinion should have a blog for all the great stuff that he advised me untill now - showed me even a better alternative. The third - best - alternative is that you trick your Windows XP or Windows Vista that www.site.com is on a certain IP - therefore server. Let's say for example that the existing site www.b4business.si is on IP 123.123.123.123. And the new server where we want to develop the site is on IP 123.123.123.321.

All we need to do is to edit the hosts file, which is located in c:\windows\system32\drivers\etc folder. At the end add the hostname (domain) and desired IP. - like in the picture below:

In Vista you have to have administrative rights to edit that file. After you've updated the hosts file, flush the DNS resolver cache (Start --> Run --> ipconfig /flushdns) and the the hosts file overrides any dns. Now you can edit the www.b4business.si on a new server.

When the site is ready, change the DNS to point to the new site and don't forget to remove the entry in hosts file.

Update: I've had the path to the file wrong. Now it's ok.

8/13/2007

Rearranged my blog homepage a bit...

It was a while from when I was checking what interesting gadgets blogger had to offer. Ofcourse checking them I was pleasantly surprised. So not so long ago using some new gadgets, I've rearranged my homepage a bit:

  • removed "About me" part
  • added "Read about" section with all my tags so you can filter
  • using a new feature in Blogger - added a small poll - which content you find most useful - you're invited to answer it so can get a feedback about what to write more. :) 
  • shuffled the right hand column a bit.

8/10/2007

fromURL - translate characters from URL

As mentioned in my previous post, you can pass parameters throught URL between pages. The problem can arise if you have special characters in parameters, like č, ž, š, spaces, etc. If you have the url

http://www.mysite.com/default.aspx?test=12 3

it will change to http://www.mysite.com/default.aspx?test=12%203 - so spacebar is converted to %20. And the function queryString would also get the value of parameter test to be 12%203. To complement the querystring you can use the fromUrl function that I've prepared, to translate these kind of characters:

 

function fromUrl(rezultat) { 
    rezultat = rezultat.replace(/%C4%8D/g,'č')
    rezultat = rezultat.replace(/%C4%8C/g,'Č')
    rezultat = rezultat.replace(/%C5%A1/g,'š')
    rezultat = rezultat.replace(/%C5%A0/g,'Š')
    rezultat = rezultat.replace(/%C5%BE/g,'ž')
    rezultat = rezultat.replace(/%C5%BD/g,'Ž')
    rezultat = rezultat.replace(/%22/g,'"')
    rezultat = rezultat.replace(/%20/g,' ')
    rezultat = rezultat.replace(/%23/g,'#')
    rezultat = rezultat.replace(/%25/g,'%')
 return rezultat
}

In the function above I've used the most common characters that need translation in slovene plus double quotation mark, spacebar, hash and percent sign. You can add more characters, I've prepared a table of characters and codes below. So now using a combination of these two functions

fromUrl(queryString('test')) would return the value 12 3.

Table of codes for URL encoding

Code Character   Code Character
%20 (space)   %C4%B8  ĸ 
%21 !   %C4%B9  Ĺ 
%22 "   %C4%BA  ĺ 
%23 #   %C4%BB  Ļ 
%24 $   %C4%BC  ļ 
%25 %   %C4%BD  Ľ 
%26 &   %C4%BE  ľ 
%27 '   %C4%BF  Ŀ 
%28 (   %C5%80  ŀ 
%29 )   %C5%81  Ł 
%2A *   %C5%82  ł 
%2B +   %C5%83  Ń 
%2C ,   %C5%84  ń 
%2D -   %C5%85  Ņ 
%2E .   %C5%86  ņ 
%2F /   %C5%87  Ň 
%C4%80  Ā    %C5%88  ň 
%C4%81  ā    %C5%89  ʼn 
%C4%82  Ă    %C5%8A  Ŋ 
%C4%83  ă    %C5%8B  ŋ 
%C4%84  Ą    %C5%8C  Ō 
%C4%85  ą    %C5%8D  ō 
%C4%86  Ć    %C5%8E  Ŏ 
%C4%87  ć    %C5%8F  ŏ 
%C4%88  Ĉ    %C5%90  Ő 
%C4%89  ĉ    %C5%91  ő 
%C4%8A  Ċ    %C5%92  Œ 
%C4%8B  ċ    %C5%93  œ 
%C4%8C  Č    %C5%94  Ŕ 
%C4%8D  č    %C5%95  ŕ 
%C4%8E  Ď    %C5%96  Ŗ 
%C4%8F  ď    %C5%97  ŗ 
%C4%90  Đ    %C5%98  Ř 
%C4%91  đ    %C5%99  ř 
%C4%92  Ē    %C5%9A  Ś 
%C4%93  ē    %C5%9B  ś 
%C4%94  Ĕ    %C5%9C  Ŝ 
%C4%95  ĕ    %C5%9D  ŝ 
%C4%96  Ė    %C5%9E  Ş 
%C4%97  ė    %C5%9F  ş 
%C4%98  Ę    %C5%A0  Š 
%C4%99  ę    %C5%A1  š 
%C4%9A  Ě    %C5%A2  Ţ 
%C4%9B  ě    %C5%A3  ţ 
%C4%9C  Ĝ    %C5%A4  Ť 
%C4%9D  ĝ    %C5%A5  ť 
%C4%9E  Ğ    %C5%A6  Ŧ 
%C4%9F  ğ    %C5%A7  ŧ 
%C4%A0  Ġ    %C5%A8  Ũ 
%C4%A1  ġ    %C5%A9  ũ 
%C4%A2  Ģ    %C5%AA  Ū 
%C4%A3  ģ    %C5%AB  ū 
%C4%A4  Ĥ    %C5%AC  Ŭ 
%C4%A5  ĥ    %C5%AD  ŭ 
%C4%A6  Ħ    %C5%AE  Ů 
%C4%A7  ħ    %C5%AF  ů 
%C4%A8  Ĩ    %C5%B0  Ű 
%C4%A9  ĩ    %C5%B1  ű 
%C4%AA  Ī    %C5%B2  Ų 
%C4%AB  ī    %C5%B3  ų 
%C4%AC  Ĭ    %C5%B4  Ŵ 
%C4%AD  ĭ    %C5%B5  ŵ 
%C4%AE  Į    %C5%B6  Ŷ 
%C4%AF  į    %C5%B7  ŷ 
%C4%B0  İ    %C5%B8  Ÿ 
%C4%B1  ı    %C5%B9  Ź 
%C4%B2  IJ    %C5%BA  ź 
%C4%B3  ij    %C5%BB  Ż 
%C4%B4  Ĵ    %C5%BC  ż 
%C4%B5  ĵ    %C5%BD  Ž 
%C4%B6  Ķ    %C5%BE  ž 
%C4%B7  ķ    %C5%BF  ſ 

Technorati tags: , ,