I am trying to get the CAML for a custom content type that I am creating. What I am really doing is creating the content type in Visual Studio 2010 and then deploying that content type to my sandbox. At that point, I am modifying the content type using the SharePoint interface (i.e changing advanced settings, adding columns, etc). What I would like to do, is after I have made my changed, update my CAML in Visual Studio to match my changes.

I want to do this because I am creating custom fields and content types for my project and want to create a solution with these customizations. Since there doesn't seem to be a way to do this (create custom fields and content types) as a solution using SharePoint without putting them into a list, I am using Visual Studio and CAML for this. I also want to use Visual Studio and CAML so that I can put these CAML xml files in source control so that I can version my custom fields and custom types.

I have tried using tools like http://spcamlviewer.codeplex.com/ but that doesn't seem to work with SP 2010.

Does anyone have any suggestions? I wish Visual Studio would just have an update from SP button after I have deployed my solution and made changes on the server so it would sync VS from the SP server.

4 Answers 4


Have you considered using LINQ to SharePoint?

At least use it when developing and then use the Log property of the data context and write all the generated CAML to a file.


After you create the content type and fields exactly as you want them with the web interface, you can export the site to a wsp file. This is then importable into Visual Studio 2010 (SharePoint 2010 project template). Once imported, the content types and fields will be defined in respective elements.xml files.

Granted, since it is generated code it is a bit nasty, but it cleans up easily enough.

It is possible to deploy custom content types and fields from Visual Studio by packaging them into a feature.


Another alternative to SP Manager is Gary Lapointe's custom STSADM and PowerShell commandlets. I have used his command gl-exportcontenttypes a number of times for this very situation.


SharePoint Manager 2010 is what I ended up using. This gives me what I need (plus alot of other features). It's not ideal as that would be some way to update the Schema Xml directly in VS of my custom content types and custom fields but this will do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.