SharePoint - ContentQueryWebPart, CommonViewFields and Multi-value choices

When you add a choice or lookup to the CommonViewField for a ContentQueryWebPart, if you had ticked the allow multiple-values checkbox, the CQWP will return you nothing.

Couple of people blogged about this:

http://sridharu.blogspot.com/2008/05/content-query-webpart-customization.html

http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx

Adri Verlaan [MSFT] even says:

Unfortunatly the data source that the CQWP uses does not support Mutli-Valued Lookups or Multi-Choice columns.

 

Turns out after a bit more digging around, you _can_ use multi-value choices.  To get multi-value choices to work, you need to use a different type:

Instead of Choice, use MultiChoice

<property name="CommonViewFields" type="string">MyDescription,PublishingHtml;MyTags,MultiChoice</property>

I have not had much luck with Multi-lookup and I suspect there might be some truth in what Adri was referring to.  If I consider how SharePoint might have to work with a field that contains multiple keys to a different lookup list, this problem becomes far more complex.

Anyway, at least it works for choice.

Have fun!

jliu

Windows Live configuration sync

I had this idea that popped up when I was listening to the current .NET Rocks - The Future of Web Development Panel.  I was listening to the panel lamenting about having to manually configure their development environment per machine that they use and thought, geez surely this can be solved perfectly with Windows Live.

Sure enough, within minutes of this idea popping in my head, one of the guys on the panel stated this, and got overwhelming applause.

That is one great idea.

So, you have Windows Live Mesh right now.  You can sync files, links and photos online.  How hard would it be to synchronize Visual Studio settings, office settings / templates, browser settings, etc etc

Taking the idea further, there is a set of tools you always use for your machine - wouldn't it be nice if you can re-use a license key (if it allows) across all your machines and share them via a Live Mesh account.

Or even when you build a new machine, a Life Mesh application automatically asks you if you want to re-install all your favourite tools that you had on your previous machine - tells you if it has a newer version (say for windows 7), and / or any driver requirements.

When you say "yes please", it will install these for you at a convenient time - AND copy your configuration settings so it'll behave JUST THE WAY you had it set up before!

Throw in some integration with Microsoft Online Store...

I can't stop drooling.  If someone don't build this app soon I will!

It is so great to live in a Software + Service world!  These are great times!

I twit now (oh and I still blog)

I'm sorry I'm probably very very late to the bandwagon, but there's a few reasons for this:

  1. Just ain't very keen to login to Facebook all the time to just update a status
  2. I know twitter had been the thing...  I'm trying to redeem myself
  3. Was at powertodevelopers event, when everyone was whipping out their iPhone / windows mobile to twit, I didn't have an account so it was a bit embarrassing
  4. Unless you twit you won't know what it's all about...

Anyway, follow johnnliu (double-n)

SharePoint: Error when adding a new page based on a customized (broken) page layout

Exception:

No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)  

image

Some interesting bits in the stack trace:

... at System.Activator.CreateInstance(Type type)

... at Microsoft.SharePoint.WebPartPages.SPWebPartSerializer.get_DefaultControl()

... at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPart(WebPart webPart, String zoneId, Int32 zoneIndex)

snipped remaining massive stack trace.

What had happened was that we had a stuffed up Page Layout with a web part zone that contained invalid HTML.

I had detected this and deleted the entire web part zone, but SharePoint must have it in the database, so each time I re-open the PageLayout it was resurrecting all the broken code.

The fix wasn't at all glamorous:

  1. Check out the page layout
  2. Fix it enough in the code view so that the designer will load the designer view
  3. Delete the webparts in the designer view
  4. Switch back to the code view - there's now a few remaining bits of broken HTML left around the web part zone - fix those.
  5. Save everything
  6. Close file, re-open it
  7. Check the file is now clean HTML

We can now use the page layout to create new pages again.

jliu

Didn't know it could be this difficult to pull something out of the GAC

So, a few days ago, one of my favorite TFS/Outlook add-on stopped working.

Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

image

Puzzled, I figure there's something odd with the Fusion loader.  Popping into the GAC I saw this horror!

image

I must have installed something that upgraded all the library to version 9.0.  OK, no problems, let me uninstall the old version 8...

Exception:
Assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client' could not be uninstalled because it is required by other applications.

image

A bit of reading lead me to this article.

GAC Assembly Trace Reference
http://blogs.msdn.com/junfeng/archive/2004/09/13/228651.aspx

 

Hitting gacutil to see what's referencing it...

c:\Program Files\Microsoft Visual Studio 9.0\VC>gacutil /lr Microsoft.TeamFoundation.WorkItemTracking.Client

Microsoft (R) .NET Global Assembly Cache Utility.  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  Microsoft.TeamFoundation.WorkItemTracking.Client, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86
              SCHEME: <WINDOWS_INSTALLER>  ID: <MSI>  DESCRIPTION : <Windows Installer>
  Microsoft.TeamFoundation.WorkItemTracking.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86
              SCHEME: <WINDOWS_INSTALLER>  ID: <MSI>  DESCRIPTION : <Windows Installer>

Number of items = 2

Taking great care not to uninstall both versions, I'm being ultra cautious:

c:\Program Files\Microsoft Visual Studio 9.0\VC>gacutil /l "Microsoft.TeamFoundation.WorkItemTracking.Client, Version=8.0.0.0"

The Global Assembly Cache contains the following assemblies:
  Microsoft.TeamFoundation.WorkItemTracking.Client, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86

Number of items = 1

Ok... go crazy!

c:\Program Files\Microsoft Visual Studio 9.0\VC>gacutil /u "Microsoft.TeamFoundation.WorkItemTracking.Client, Version=8.0.0.0"
Microsoft (R) .NET Global Assembly Cache Utility.  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly: Microsoft.TeamFoundation.WorkItemTracking.Client, Version=8.0.0.0, Cul
ture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86
Unable to uninstall: assembly is required by one or more applications
Pending references:
              SCHEME: <WINDOWS_INSTALLER>  ID: <MSI>  DESCRIPTION : <Windows Installer>
Number of assemblies uninstalled = 0
Number of failures = 0

Not knowing the keys to run gacutil /ur, I turned and did more research:

This one is from the Fusion guys

http://blogs.msdn.com/alanshi/archive/2003/12/10/42690.aspx

I found two of the reference keys in the registry.  And exported them just to be safe.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\Global]
"Microsoft.TeamFoundation.WorkItemTracking.Client,Version=\"8.0.0.0\",PublicKeyToken=\"b03f5f7f11d50a3a\",Culture=\"neutral\",RuntimeVersion=\"v2.0.50727\",processorArchitecture=\"X86\""=hex(7):65,\
  00,45,00,65,00,2b,00,48,00,25,00,65,00,30,00,78,00,40,00,45,00,59,00,7a,00,\
  4b,00,4c,00,2c,00,70,00,71,00,5e,00,41,00,3e,00,2e,00,32,00,2a,00,7d,00,66,\
  00,7b,00,40,00,35,00,49,00,3f,00,69,00,4a,00,68,00,67,00,78,00,59,00,7a,00,\
  7a,00,4c,00,2c,00,00,00,00,00
"Microsoft.TeamFoundation.Common,Version=\"8.0.0.0\",PublicKeyToken=\"b03f5f7f11d50a3a\",Culture=\"neutral\",RuntimeVersion=\"v2.0.50727\",processorArchitecture=\"X86\""=hex(7):65,\
  00,45,00,65,00,2b,00,48,00,25,00,65,00,30,00,78,00,40,00,45,00,59,00,7a,00,\
  4b,00,4c,00,2c,00,70,00,71,00,5e,00,41,00,3e,00,66,00,6c,00,45,00,37,00,36,\
  00,72,00,3f,00,47,00,34,00,3d,00,59,00,49,00,29,00,41,00,4c,00,71,00,5f,00,\
  5f,00,58,00,54,00,00,00,00,00

Then I dropped these trace references from the registry.

Head back to the GAC, uninstall the two offending Assemblies.

Pop back to Outlook.  Hey, my favorite addon works again.

:-)

Hope this helps someone out there.

jliu