Visual Studio 2010 SharePoint List Template Error

I was attempting to create a custom FAST Search Center that would have a custom master page, and some web parts added to the search and result pages. My starting point was to grab the FAST Search Center site definition from the site templates in the SharePoint 14 Hive.

Next, I added the search tab and result tab lists to the site collection. Again I copied the XML from the SharePoint site definition…well almost. I actually copied all but the root node which had an XML namespace. After pasting this content I noticed under a few nodes, and some attributes, the little squiggly line. When I built the solution I noted warning messages but there were no errors. However, the deployment failed with an XML validation error.

As I began comparing the SharePoint list template with my list template I began removing various segments, starting with the ones that we marked as errors. While this resolved the deployment issue my lists did not function properly with the Site Template.

Next, I removed the XML namespace and the restored the previously erroneous XML, this time without any squiggly line or build warnings. When I deployed the solution no errors or failures occurred and my Custom FAST Site Template worked perfectly.

SQL Server Date vs. DateTime columns and the SharePoint 2010 External Content Type

Recently I have been working on a SharePoint 2010 solution that leverages External Content Types for storing information associated with Microsoft Dynamics Great Planes Timesheets. Part of the information captures when an task is expected to be completed, which the UI allows the user to select a date from a calendar. Since the only significant information for this field was the date when I designed the database I chose to only capture the date value. Testing on my local Windows 7 VM worked perfectly and we rolled the solution out to the customer for testing.

In the late testing stages the customer sent back a critical issue. The date value selected by the user was being changed, worse when the associated information was imported from Timesheet to Timesheet (because it was an ongoing task) the dates were moving further and further back in time.

I have seen this issue before with SharePoint 2007, pre SP1, that on DateTime field inputs if you didn’t convert to from local time to UTC your dates would not appear correctly. Immediately I added code to manually convert my captured time from local to UTC. I then changed the Time Zone on my VM so I would have a similar offset (originially I was running with GMT time myself thus I had not seen this issue). As I began testing I continued to see the same issue the customer was seeing, even with my conversion to UTC.

With the debugger attached I began looking at the values going into and out of the database. What I noticed was that a value going in would be something like 1/1/2011 05:00:00 but the value being returned looked like 12/31/2010 19:00:00. Looking into the External Content Type I noticed that it was using a DateTime .NET object. This means that when the value is retrieved from the database if the time is not in the database field then it defaults to 12:00:00. From there SharePoint performs the conversion from UTC to the local timezones (in this case subtracting 5 hours).

Lesson from this is to make sure you use full date time fields with your external content types.

Microsoft Silverlight 4 and SharePoint 2010 Integration

Recently I was contacted by PACKT Publishing because they have recently published a book Microsoft Silverlight 4 and SharePoint 2010 Integration and wanted me to review the book.  I’m actually quite excited about this opportunity because it is my first invitation to review a book, and the book is talking about two of my favorite technologies!

Currently I have a deadline approaching for a SharePoint 2007 Farm Architecture document, my least favorite thing to do, so I’m not allowing myself a lot of time with “fun” stuff like the topics in this book until the documentation is complete.  However, I have reviewed the first chapter and I really can’t wait to get back to it.  The first chapter is a very straight forward approach to creating a Silverlight Application and then including it in SharePoint 2010.

PACKT has published the first chapter “Integrating Silverlight 4 with SharePoint 2010” here for others to read before purchasing the book.

Once I have gotten through my documentation work I will take the time to review the book, try the examples, and will then post more about it here on my blog.

SharePoint Lists Web Service

During a recent project I was leveraging the SharePoint Lists Web Service to retrieve information from a list and push it to a Silverlight display.  The list I was using was a heavily customized list with about 35 different views and at least as may fields.  My Silverlight display would provide information like the “status” of the list item based on a number of other criteria.  This status field was stored as a simple “Single line of text” field in the SharePoint list.

The first issue I had to resolve was how to get the right view for the SharePoint list.  The frustration with this is that the Lists Service’s (lists.asmx) GetListItems action has the second parameter “viewName” the documentation on this parameter actually specifies the proper value is a GUID.  I will write another blog about how I retrieved the view’s GUID later, but for now just understand that I did have to take that into account.

After getting the proper view information I now needed to filter the list so that only particular items I was interested in would be returned.  I added the query parameter to perform the filtering as well as adding the viewFields parameter to ensure that I received the fields I expected.

At this point I went ahead and executed my code thinking that I was now good to go and should receive my filtered list items.  On the initial execution an exception was thrown, so I placed a breakpoint on the xml result from the GetListItems call and re-executed.  When I hit the breakpoint I looked at the and noticed the status field was missing.  I allowed the code to continue and when it attempted to access the status field the exception was thrown.  I verified that I had the correct view, view fields, filters etc and nothing looked out of place.

I think downloaded U2U’s CAML Query Builder (a tool I HIGHLY recommend if you are building CAML queries) and tested my query in that.  Interestingly, I noticed that the status field was missing in U2U’s output.  I then modified the query, I removed the <where>…</where> statement, so that all list items would be returned and suddenly the status field appeared.

I reexamined the list item data, and since it had no value in the status field I decided to add one (something that normal users are not allowed to do in the production list).  I executed my query in the U2U tool and noticed that now the status field was available.  Again I went back to the list and removed the status field value, and again the field was removed from my query results.

I have tested this scenario with a number of other lists all using the single line of text field and have noticed similar outcomes, the field is not returned if it has no value.  I have since modified my code to handle the case where the field may not be returned and I use a default “status” value.  I have since noticed that this is pointed out in the commends (second from the bottom at the time of me writing this blog) but is not included anywhere in the documentation.

Best of luck!


I’ve been working with WCF and SharePoint 2007 and ran across an issue.  The scenario is an Account Registration process which allows the user to request access to “protected” sites within a portal.  This solution blends some jQuery and WCF using the JSON format for request and response messages.  The issue I ran into was when a user requested access to a/several sites I needed to pass the Site ID to the WCF service as part of the user request object.

User Request Object

public class UserDetails
[DataMember] public string UserName;
[DataMember] public string Provider;
[DataMember] public string FirstName;
[DataMember] public string LastName;
[DataMember] public string Email;
[DataMember] public string Organization;
[DataMember] public string Title;
[DataMember] public string Department;
[DataMember] public string Position;
[DataMember] public string WorkAddress1;
[DataMember] public string WorkAddress2;
[DataMember] public string City;
[DataMember] public string State;
[DataMember] public string Zip;
[DataMember] public string Phone;

        [DataMember] public string Country;

        [DataMember] public string CountryCode;

        [DataMember] public IUserDataExtension ExtendedInformation;

        private static Type[] GetKnownTypes()
return KnownTypesProvider.GetKnownTypes();


Ok, so the first thing you might notice is the KnownTypes, but for now lets just agree that it works and I’ll talk about it in a later blog.  Now you do notice I have a IUserDataExtension object in the User Details, and that is what we will talk about here, or at least an item in it.

Here is the implemenation of the IUserDataExtension:

public class ExtendedUserDetails : IUserDataExtension
public ExtendedUserDetails()
Worksites = new List<string>();

        [DataMember] public List<string> Worksites;

        [DataMember] public string Justification;

So the key piece here is the Worksites List.  Notice I am capturing the values as string, but in reality they are Guids that I retrieve from SharePoint using a different web service.  I chose to use strings because Guid has a constructor that takes a string object and I figured this would let me handle the casting and exceptions if something when wrong.

At this point I began testing and everything worked, as long as I did not pass any worksite IDs to my service.  As soon as I would include a worksite ID I would end up with a 400 error code and a web page that said “The server encountered an error processing the request. See server logs for more details”, but of course the server logs had nothing about the error in them.  Attaching a debugger never did any good because my WCF functions were never reached, so somewhere earlier in the call stack an exception was being thrown.

I began experimenting, and just on a whim decided, “Well, javascript doesn’t know about ASP.NET Guid objects, it just sees them as string, but what if I set the List type to Guid?”  So I changed the class as follows.

public class ExtendedUserDetails : IUserDataExtension
public ExtendedUserDetails()
Worksites = new List<Guid>();

        [DataMember] public List<Guid> Worksites;

        [DataMember] public string Justification;

Once I compiled and upgraded my solution, TA DA!  So the lesson of this story is that you CAN’T pass Guids as string to a WCF service.  My belief is that during the parsing of this object the format matches that of a Guid so WCF casts the object to string, but when it tries to find an object with List<Guid> container that fails and an exception is thrown, hopefully some of my contacts at Microsoft will be able to shed some light on this for me.

SharePoint 2010 Document Set, Create Your Own

In preparing for a demo I wanted to show just how easy and powerful Document Sets in SharePoint 2010 can be.  Using the Public Beta I followed Liam Cleary’s steps to enable documents sets, but realized that an empty Document Set really doesn’t help show the power.  I decided to dive in and see if I could create my own custom Document Set, and here are my successful steps.

Getting Started

Before we go further the important thing to realize at this point is that Document Sets in SharePoint 2010 are a new Content Type for folders.  That being said, like in MOSS/SharePoint 2007 Content Types can/should be extended to fit your needs.

Build Your Document Set Content Type

Before following these steps make sure you have already enabled Document Sets in your Site Settings.  For instructions refer to Liam Cleary’s blog about the document sets.

  1. Go to your Site Settings
  2. Select Site content types from the Galleries section
  3. Select Create on the Site content type page
  4. Provide a Name for the new Document Set Content Type.  Select Document Set Content Types as the Parent Content Type (if this is not available then you have not followed Liam’s blog successfully).  Choose the Group, or create a new one, that you want this Content Type included in and click OK.

Your new Document Set Content Type should now have successfully created, but we really have not created anything different from the existing Document Set Content Type.  Next, we will add several documents to this document set that we want to include when one of these are used.

  1. Select Document Set settings
  2. In the Allowed Content Types choose the types of Content you want to allow the Document Set to contain.  (Any Content Types you want to create when the Document Set is created should be included in this list).
  3. In the Default Content Select the Content Type you want to include and a “Template”, if allowed, that should be generated.  For multiple items click the Add new default content … link as many time as necessary (or allowed).
  4. Click OK

You probably noticed that there are several other settings on the page that you can enable/disable/use, but for the purpose of this blog I chose to ignore them.  In future blogs I’ll go back and discuss what some of these options are and how they can be useful.

Use Your Document Set

So at this point you have now created your custom Document Set Content Type and associated documents with it that should be created whenever this Content Type is used.  Next we will actually make use of the new Document Set.

  1. Go to the Document Library where you wish to use the Document Set (if you don’t have one yet then go ahead and create one now.
  2. In the Library Settings (available on the Library Tools:Library ribbon) choose the Advanced Settings.
  3. In Advanced Settings for the Allow management of content types? choose Yes and click OK
  4. In the Content Types section of the Library Settings choose Add from existing site content types
  5. From the Select Content Types choose the name you used for your Document Set and Click OK

At this point if you want you can also choose to change the ordering of Document/Document Set so that when a user clicks the “New” button they will end up with your Document Set rather than a standard document.

Finally, you can now create your new Document Set, and when the creation completes you should see your custom documents in the newly created Document Set.



Windows 7 Simplifies the Versions

I wrote a while ago about doing some testing with Windows 7 Beta and how I was excited about the new features, interface, etc.  I also expressed a concern as many other did about the “Versions” of Windows 7 Microsoft may make available.  Well, it looks like someone in Redmond was listening, maybe not to be but they did hear the Windows community, and they have now announced ONLY THREE versions of Windows 7.

  1. Windows 7 Home Premium
  2. Windows 7 Professional
  3. Windows 7 Ultimate

Microsoft also solved a lot of complaint about Vista by basically “layering” these versions so users don’t have to worry about functionality tradeoffs between versions.  Now if you buy Professional, you have essentially bought Home Premium + some important business stuff (domain participation, network share backup, etc) and when you buy Ultimate you have Home Premium + Professional + some other stuff.

So today I encourage everyone to rejoice in the joy, warm sun shine, rainbows, and unicorns and sing out “HAPPY DAY, only three versions of Windows 7.  Now we really CAN pick a version of Windows we want to upgrade our XP boxes to.”

Maximum PC: Windows 7 Buyer’s Guide

Microsoft: Which one is right for you?

OneNote 2007

I have been working on blogging more regularly and ran into the issue that my company, MicroLink LLC (, as part of our internal portal has blogging enabled in our MySite spaces. However, the MySite locations are internally accessable and I really wanted a publicly accessable site that I could use to provide information for some of our customers, and CodePlex users. Thus I created a Live Space site ( and even began using the Live Writer for my blogging. I really liked the Live Writer application, but still needed the ability to publish to my internal MySite blog. Given that I had MS Word 2007 I began using that to compose my blogs and then publish to multiple blog site, good so far. Then I began to realize I needed some method to keep these items organized and also wanted a way to get rid of all the little post-it notes on my desk and scratch pieces of paper where my notes were stored.


Enter OneNote 2007


Thanks to one of my coworkers I installed OneNote2007 and began using it, in fact I am using it right now to compose this blog. Only 2 days into real use of OneNote and I have found so much value. I now open OneNote at the beginning of my day and never pick up a pen or pencil the entire day. Reorganizing the notes is easy, write anywhere on the "page" you want, I am hooked. The other great feature is the integrated search, no more looking through dozens of word, powerpoint, excel documents, OneNote has it and can find it.


Blogging is also made easy, just send your OneNote page to a blog, which actually opens MSWord 2007 and publish.


Coolest Feature


I have found that the coolest feature in OneNote is pasting from a web site. I have a ton of notes about how to resolve this issue or that issue, but I can never seem to find the site where it was originally posted. With one note after copying the text from the website when I paste it in I automatically get a reference link to the site where I copied it from! You just can’t beat that (forget sliced bread).

Web Resource, Solving JavaScript inclusion in your Web Part

Working with client side controls requires a lot of javascript, and I have often just written the javascript in the Render or RenderHTML functions of my web controls.  This works, but is NOT the best, or even a recommended method to do this.  So I began looking around and found this nice capability, but there are some major pitfalls to be aware of!
There are several other sites, blogs, etc which explain this information which I originally referenced, but I had several issues as many of them included only partial examples.  What I have tried to do is consolidate what I found on several other blogs.
This example is based on a current Mirolink development project for Virtual Earth 6.  The projects namespace is MicroLink.Applications.VirtualEarth.Core.  The javascript file is at the root level of the project and is Core.js.  The webpart is coded in the VirtualEarthControl.cs file also located at the root level of the project.  This information is critical to be aware of in the steps below!
ASP.NET 2.0 introducted the WebResource capability to include javascript, image, and other "resource" files within a DLL.  Using the WebResource is actually pretty simple, just follow these three steps.
Step 1
Add your resource (.js, .css, etc) to the project you want to bundle it with.  Set the Build Action property to Embedded Resource.
Step 2
In the AssemblyInfo.cs file, usually located in the Properties folder add the following line:

[assembly: WebResource("MicroLink.Applications.VirtualEarth.Core.Core.js", "application/x-javascript")]

Notice that the resource name is actually formed [Package] {.SubFolder}.[Filename].  This is not noted anywhere in the MSDN!

Step 3
In the web part class file (VirtualEarthControl.cs) add the following line for security

[AspNetHostingPermission(SecurityAction.Demand, Level= AspNetHostingPermissionLevel.Minimal)]

Finally to reference the resource:

string coreJS = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "MicroLink.Applications.VirtualEarth.Core.Core.js");