Geeks With Blogs


My name is David Jacobus I am a former teacher of Computer Science and Mathematics, who is now working full time as a SharePoint Consultant! I have raced off-road motorcycles for 30+ years! I have fallen in love with Glamis and the Dune experience the last few years! My friends like to say: Jake, with age comes the cage! I suppose that is because at Glamis I use a Razor XP 900! Which has a full roll cage!

David Jacobus SharePoint Consultant

I am blogging this as I hope to prevent anyone else spending extra time on this.  I was having problems with a content type/site columns feature.  Actually everything was working correctly except choice fields were not displaying:


I should have been guided by the fact that I could do it in a Console application but not in a feature!  However, I am getting a little older and my mind is still “Tarp as a Shack”  you get it!    The problem is that in Sandboxed solutions intellisense is not pared to the subset of code that is allowed!  I think this particular code  issue is a bug and needs to be addressed by Microsoft as it has a far-reaching effect of having code that should be Sandboxed run as a farm solution. In any event here is how I troubleshot this particular issue:


Lookup Field working


Choice Fields not working


Multi Choice Field is disabled???

Debugging when these are added shows that the field is not being updated:



Shows count = 0 on choices????? Hmmm; this can only mean one thing!  We cannot change the choices in a sandboxed solution!

Yes, This is a bug!!!


I added the code as a farm solution and these columns work!!! 

Okay!  Why am I blogging this?  To do sandboxed code without a full trust proxy there are many decisions that are made to make your code work!  For example in this project one of the decisions I made was that I didn’t have access to the site property bag  from a sandboxed solution so I had to resort to adding a new list for Configuration as Microsoft’s new guidance around content types is not to delete them but hide them as they may be referenced from other sources.  So, I added the list and used it to see if the content type exists, if it does: Hide the content type and add a new one with a different name on the feature activation event. Then write the  new name back to the configuration list.  Another, was I couldn’t use logging .  Event  logging is not allowed in a sandboxed solution.

To further address this is that Microsoft has published  SharePoint 2010 Guidance solution  which does have a logging and Property bag ( PROXY) which mitigates these two issues.  So maybe they should be on every SharePoint 2010 farm. I have spent an inordinate amount of time trying to solve issues around adding content types in code from within a sandboxed solution .  From what I see here is that it is possible for a subset of the fields that might be required but certainly not Choice fields.   So the end result is that I could have made this a farm solution to begin with.  The solution has three projects content type (Farm Solution) drop down lookup lists (Sandbox Solution) and configuration list (Sandbox Solution).  I hope this helps others  not make my mistake in the future.

Posted on Wednesday, August 18, 2010 2:19 PM | Back to top

Comments on this post: SharePoint 2010 Content Types and Site Columns (Choice Fields not Working)

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © David Jacobus | Powered by: