2

私は SharePoint 2010 を使い始めたばかりです (少し遅いスターターと言えます!) SharePoint 2007 で通常行うように、GUI を介してリストを作成しました。次に、Gary la pointe stsadm エクステンションを使用して、フィールド XML を抽出します。それらをビジュアルスタジオ内の機能に配置します。

これはまだできるのかと思っていました!2010 stsadm コマンドで gl-Exportsitecolumns コマンドが見つかりません。

パワーシェルの代替手段はありますか?

ヘルプやガイダンスをいただければ幸いです。

乾杯のTruez

4

2 に答える 2

2

私はpowershellでそのような代替手段について知りません。しかし、非常に簡単な解決策は次のコードです。

$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
于 2012-05-10T09:52:59.300 に答える
1

PowerShellの代替手段はここにあります:PhilChildsによるexport -and-importcreate-site-content.html

$sourceWeb = Get-SPWeb http://portal
$xmlFilePath = "C:\Install\Script-SiteContentTypes.xml"

#Create Export File
New-Item $xmlFilePath -type file -force

#Export Content Types to XML file
Add-Content $xmlFilePath "<?xml version=`"1.0`" encoding=`"utf-8`"?>"
Add-Content $xmlFilePath "`n<ContentTypes>"
$sourceWeb.ContentTypes | ForEach-Object {
    if ($_.Group -eq "Custom Content Types") {
        Add-Content $xmlFilePath $_.SchemaXml
    }
}
Add-Content $xmlFilePath "</ContentTypes>"

$sourceWeb.Dispose()
于 2012-07-24T21:19:06.847 に答える