powershell 使用SDL Web核心服务更改嵌入式架构字段的根元素名称

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 使用SDL Web核心服务更改嵌入式架构字段的根元素名称相关的知识,希望对你有一定的参考价值。

$ErrorActionPreference = "Stop"

# get a Core Service client
Import-Module Tridion-CoreService -Verbose:$false
Set-TridionCoreServiceSettings -Version "Web-8.1" -HostName localhost -ConnectionType Basic

$client = Get-TridionCoreServiceClient                              

# get the parent schema to edit
$schemaId = "tcm:21-4247-8"
$schema = Get-TridionItem $schemaId

# change the InterestArea embedded component root element name
[xml] $xmlSchema = $schema.Xsd
$ns = @{xsd="http://www.w3.org/2001/XMLSchema"}
#to be extra careful to update the right thing you could use this: $xpath = "//xsd:element[@name='MarketingStory'][@type='Section']"
$xpath = "//xsd:element[@name='MarketingStory']"  # this is the XML fieldname in the parent schema
$element = $xmlSchema | Select-Xml -XPath $xpath -Namespace $ns
if($element -eq $null)
{
    Write-Error "Did not find element $xpath"
}
$element.Node.type = "Section"    # this is the root element name from the embedded schema
$schema.Xsd = $xmlSchema.OuterXml

# save the schema
$readBackOptions = New-Object Tridion.ContentManager.CoreService.Client.ReadOptions
$updatedSchema = $client.Update($schema, $readBackOptions)
Write-Host "Saved updated schema" 

# you can read and verify the changed schema
#$schema.Xsd

以上是关于powershell 使用SDL Web核心服务更改嵌入式架构字段的根元素名称的主要内容,如果未能解决你的问题,请参考以下文章

powershell 使用SDL Web核心服务更改嵌入式架构字段的根元素名称

powershell 使用SDL Web核心服务更改嵌入式架构字段的根元素名称

powershell 使用PowerShell和核心服务淘汰SDL Tridion 2013 SP1发布目标。见http://tridion.stackexchange.com/questions/1

powershell 使用PowerShell和核心服务淘汰SDL Tridion 2013 SP1发布目标。见http://tridion.stackexchange.com/questions/1

powershell 使用Windows服务依赖性安装SDL Web Content Delivery mico服务

powershell 管理SDL Web 8服务