Hi,
I need to create around 50 custom site columns via powershell.
My XML file has this content
<SiteColumns>
<Field Type="DateTime"
Name="DOcumentationReview"
Description="Shows the next review date of the document"
DisplayName="Development Review Team"
StaticName="DevReviewReview"
Group="SP2010 Applications"
Hidden="FALSE"
Required="FALSE"
Sealed="FALSE"
ShowInDisplayForm="TRUE"
ShowInEditForm="TRUE"
ShowInListSettings="TRUE"
ShowInNewForm="TRUE"></Field>
</SiteColumns>
I decided to read the xml file in the usual way as
[xml]$s = get-content sitecolumns.xml
Now I want to get the complete node <Field as a string so that I can use in this fashion.
$siteColl = Get-SPSite -Identity "http://mydevsite/"
$rootWeb = $siteColl.RootWeb
$fieldXMLString = '<Field Type="DateTime"
Name="DOcumentationReview"
Description="Shows the next review date of the document"
DisplayName="Development Review Team"
StaticName="DevReviewReview"
Group="SP2010 Applications"
Hidden="FALSE"
Required="FALSE"
Sealed="FALSE"
ShowInDisplayForm="TRUE"
ShowInEditForm="TRUE"
ShowInListSettings="TRUE"
ShowInNewForm="TRUE"></Field>'
$rootWeb.Fields.AddFieldAsXml($fieldXMLString)
How can I loop through the 'Field' node and get the entire node content as a string?









