visual-studio-2010powershellsharepoint-2010stsadm

SharePoint 2010 Exporting site fields to an XML file


I have just started working with SharePoint 2010(you could say a bit of a late starter!) I have created a list via the GUI as i normally would with SharePoint 2007. I would then use Gary la pointe stsadm extentions to extract the fields XML and place them in to a feature within visual studio.

I was wondering can this still be done! I can't find the gl-Exportsitecolumns command in the 2010 stsadm commands!

Is there a powershell alternative?

Any help or guidance would be muchly appreciated.

Cheers Truez


Solution

  • I don't know about such alternative in powershell. BUT very easy solution can be this piece of code:

    $w = Get-SPWeb http://localhost/subweb
    $w.Fields | select SchemaXml # option 1: prints all xml to console
    $w.Fields | select schemaxmlwithresourcetokens # option 2: the same, but with resource tokens
    $w.Fields | %{ $_.schemaxml } | out-file c:\temp\fields.xml -encoding unicode #option 3: saves output to text file