Monday, June 22, 2009

making pages containing lists of sites, lists

One of the projects I am working on needed some pages containing lists of subsites and lists of lists. Some examples include:

  • A top-level site that has lots of blog sites beneath it. The user wants a list of all of the blog sites to appear in a web part on the top level site.
  • A top-level site that has lots of discussion boards contained within it. The user wants a list of all of the discussion boards inside this site.


Note that top-level in this case does not necessarily mean a site collection.

I could not find a built-in web part to accomplish this. However, it is very straighforward to create a DVWP (i.e. data view web part) talking to built-in WSS web services. This is done using SharePoint Designer. Here is the process:

  • create a web part page (Site Actions >> Create >> Web part page)
  • open the page in SPD (use either Design or Split view)
  • Data View >> Manage Data Sources
  • In the Data Source Library, select Connect to a web service

Here the directions will be slightly different for sites vs. lists

For Sites:

  • use http://<your site>/_vti_bin/webs.asmx for sub-sites
  • use the GetWebCollection method
  • after creating this data source, drag it into one of the web part zones on the new page (this creates a DVWP)
  • use the context menu ">" and season to taste

For Lists:
  • use http://<your site>/_vti_bin/lists.asmx for containing lists
  • use the GetListCollection method
  • after creating this data source, drag it into one of the web part zones on the new page (this creates a DVWP)
  • use the context menu ">" and season to taste

Good luck!

Wiki pages are not first class "items" in WSS v3

One of the strengths of the WSS platform is that all of the built-in list types have the same features set, such as alerting, permissions, folders, metadata. Not!

One of my customers is doing a Web 2.0 implementation using MOSS as the platform. They will be using the Wiki page type extensively.

Now I have recently discovered that Wiki page libraries cannot make folders for the pages.

This has the potential to be a large issue for 2 reasons:

  • folders allow a better organization of the pages
  • WSS has a well-known performance issue when a single view of data becomes longer than 2000 items

So this is definitely a drawback that will need to me mitigated. It is certainly possible that a code-based solution will be the best mitigation for this issue.

Here is a MSDN thread with the start of a workaround on this.

Note further that the Kwizcom product with enhanced Wiki capability also has this limitation.

Tuesday, June 9, 2009

InfoPath cannot handle URL fields in SP lists

One component of the dream of no-code SharePoint is to store data in SharePoint lists and expose the data thru Infopath [which business analysts and administrators can use to change the UI design easily].

This dream is dimmed slightly when InfoPath cannot handle SharePoint list types correctly. In this case, URL fields are not parsed correctly causing the link field to fail [when clicked].

In this example, I made a URL field in a custom list called "u 0" and I stored a value in it.

Make the infoPath form with a datasource pointing to the custom list. Then you will see the symptom of this problem. The problem itself is caused by this XSLT code stored in view1.xsl. (Sorry, I could not get the formatting to work!)

<span class="xdHyperlink" hideFocus="1" title="" style="OVERFLOW: visible; WIDTH: 130px; TEXT-ALIGN: left" xd:xctname="Hyperlink">
<a class="xdDataBindingUI" xd:CtrlId="CTRL4" tabIndex="0" xd:disableEditing="yes">
<xsl:attribute name="href">
<xsl:value-of select="@u_0"/>
</xsl:attribute>
<xsl:value-of select="@u_0"/>
</a>
</span>


The correct code is shown below:


<span class="xdHyperlink" hideFocus="1" title="" style="OVERFLOW: visible; WIDTH: 130px; TEXT-ALIGN: left" xd:xctname="Hyperlink">
<a class="xdDataBindingUI" xd:CtrlId="CTRL4" tabIndex="0" xd:disableEditing="yes">
<xsl:attribute name="href">
<xsl:value-of select="substring-before(@u_0, ',')"/>
</xsl:attribute>
<xsl:value-of select="substring-after(@u_0, ',')"/>
</a>
</span>

I find it hard to believe but apparently noone has documented this out on the web. After I debugged it, I found this link from 2005 about the SPD predecessor, of which #5 & #6 are the answer.

It is also frustrating that Microsoft has not fixed this in the InfoPath 2007 product.

Regards..

Tuesday, May 26, 2009

Monday, May 4, 2009

export of a versioned list neglects data (WSS v3)

The use of versioning is typically very important to users. At one of my engagements using WSS V2, the IT group discouraged the use of the versioning feature since the storage mechanism (inside WSS) was very inefficient.

In WSS V3 the storage mechanism for versioning was improved and some very nice additional user features for versioning were added. Basically these are: 1) tracking versions by individual meta-data 2) alert notifications showing the old and new values.

Now I have just found out that one feature in V2 was deprecated by these changes. If you export a versioned list to Excel, only the latest version is exported. Apparently this is also true for content deployment in ECM. A user has told me that this exported all data (including previous versions) in WSS V2.

Unfortunately the only work-arounds I have found so far involve code. :-(

I have made some web services code to dump the previous versions. This was written in C#. Another approach is to write an Object Model program to address this limitation. Either approach can be written in C#, VB.Net or PowerShell.

Regards..

Wednesday, April 15, 2009

Did some testing with SharePoint Guidance

I found this out on the MSoft patterns & practices site.

Similar to the MVC thing it is designed [one hopes] to motivate SP programmers to greater productivity levels.

One thing it does for sure is show:
  • how a real application can be integrated into SP
  • how many pieces-and-parts [at the code level] are frequently required to accomplish this
There are some gotchas that I found. For an experienced SP developer, these are easy to work-around. I have not dug in to fix all of these, but for sure fixing some of these would not be easy. They are listed here along with the perceivable symptom:

  • does not work on non-port 80 webapp - instantiating the site just hangs
  • workflow build issue - second project will not build complaining about feature scoping; the fix is straightforward although you also run into some Visual Studio bug fixing it (maybe this is related to the original bug)
  • workflow run-time issue - could not get this to run correctly when set to the original site instantiated for the application; may be related to the fact that it must be instantiated in a site collection
  • theme selection issue - the theme project does not install into the Site Settings location; so the customer cannot test it out with built-in themes
  • install to more than one webapp does not work - this is because of GUID collisions
  • workflow DLLs not installed in the Contoso VPC - so when you open the workflow source code, Visual Studio complains and cannot open it
  • the directions talk about error checking, but when I schedule a course with the end date before the start date it spits out an ugly ASP.NET exception screen

So it is some distance from best practices. Rather than 1.0, I would call this a 0.7 version of guidance. Many of the issues above could be put into the destructions. Then someone does not have to stumble over the problems one-by-one.

Of course, it is more fun that way.

Regards..

Sunday, April 12, 2009

ASP.NET MVC 1.0 free book contains broken code

Hey...what a news flash!

MVC 1.0 is a new application framework for ASP.NET. I wanted to figure out what it is because it, like some other "frameworks" I use are designed to make application development closer to Code Free. This specifically is on my list since:

1) It took me a while to get my head around the ASP.NET 2.0 declarative markup programming model. It is so vast and so powerful that you need to understand at least 30-40% to be productive at all. And a higher knowledge level is needed to debug it. I have had some success using 2.0 and pushing it over to Sharepoint with relatively minimal problems.
2) Now I read about MVC like it is something new. The first time I read about it was in a SmallTalk book in the 80's.
3) Even MSoft had a MVC-type framework called MFC, again from the 80's.

Here is the blog that announces the 1.0 version.

So I loaded the Contoso VPC for SharePoint to test another framework [described in another blog entry]. Then I decided to try this MVC thing in that VPC-image. To install it, nothing more than the usual .Net framework hassles to overcome.

The link above also allows you to download the completed code that is [presumably] built up step-by-step in the book.

I have seen many cases where some group gave a tutorial book and the code and they did not agree. Whether I cared about that or not depended on the subject matter. There have been times in the past where if I really wanted/needed to learn the material and I ran in to the book does-not-equal code case, I would just skip the book and go to the documentation for the code.

In this case although I was ready for it, now that we know this is the case again, I am a little more disappointed because:

1) frameworks are big entities to learn
2) the stated goal of this book is to help someone learn
3) I have read this Scott Guthries blog in the past and he seemed like a stand-up guy
4) After reading the chapter before trying the code, almost none of the ASP.NET 2.0 decalrative framework carries over; even more reason for this think to work
5) I guarantee you these guys know the [lack of] pedagogical value of having a how-to book that is incorrect and the final code; of course, it is better than just having the book!
6) MSoft usually treats programmers better; I have seen lots of cases where they give not-quite-ready stuff to users, but they usually understand the developers have a bigger hill to climb
7)the purpose of a framework is to let the developer think big-picture; having to dig into the guts of MVC routing on your first trip to nirvana with this thing is not what the doctor ordered

So again I am naive; again the industry chucks one huge framework to move to a slightly better one that is just as hard for developers to learn.

I guess that this is another one of the benefits of open source. I guess if anybody could do it, they wouldn't need programmers, right?

Finally, there is a tweet out there somewhere found by Google when I type in "errata" about this mess. Wanna guess the fixes will be printed at the back-of-the-newspaper?

Ohh, I got up to page 45...and the code will not breakpoint in DinnerController...must be a user error!?!

Regards..