CopyUtil.aspx and Publishing Sites

Recently Jan Tielens has presented on his blog the CopyUtil.aspx SharePoint application page. What this page does is it allows you to build up a link to a List Item using nothing but ID's (Site id if linking to another Site Collection, Web id, List id and List Item id). As Jan described in his article: this page gets very useful while working with SPSiteDataQuery which returns standard all the id's mentioned above! As we're just working with the SPSiteDataQuery at Imtech, I have decided to research both items further to see what is there inside for us.

First of all the CopyUtil.aspx page redirects the end user to the requested item. Based on the passed id's it finds the requested item, builds the url and redirects the browser. The downside of this all is: that it uses 302 redirect which are not being followed by search engines while crawling. I have described this issue in detail in one of my previous posts.

Another issue I have found are the url's themselves. In order to go to the default page you need the following url: http://sharepoint/_layouts/CopyUtil.aspx?Use=id&InThisWeb=1&ItemId=1&ListId=70f2c497-0fe2-4ce7-abeb-3f3950545e13. It isn't really accessible isn't it? And I bet it won't end up high in any search engine ranking. Furthermore I didn't succeed to go to the Publishing Page itself: I ended up in either the display or edit form of the underlying List Item.

What I did found out though is, that the SPSiteDataQuery allows you to obtain the complete URL of an item like http://sharepoint/Pages/default.aspx. All you need to do is to add <FieldRef Name="EncodedAbsUrl" /> to the ViewFields property of the SPSiteDataQuery.

I believe that the CopyUtil.aspx page might by useful in certain scenario's on intranet environments. For Publishing Sites I would advise you to use either the EncodedAbsUrl or ServerUrl (begins with '/') Properties. You can discover other available Properties by exploring the contents of the XML property of a List Item. Each Property is prefixed with "_ows" which must be removed before using in CAML.

Technorati Tags: Development, SharePoint 2007, SharePoint, MOSS, WCM


comments powered by Disqus