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"
Set-TridionCoreServiceSettings -HostName localhost -ConnectionType Default

$client = Get-TridionCoreServiceClient                              

# get the component to edit
$componentId = "tcm:25-4220"

$component = Get-TridionItem $componentId
$component.Id
$component.Content

# example 1: get an older version of the component and restore the component content
$oldComponentId = $component.Id + "-v" + ($component.VersionInfo.LastVersion -1)
$oldComponent = Get-TridionItem $oldComponentId
$oldComponent.Id
$oldComponent.Content
$component.Content = $oldComponent.Content

# example 2: replace some value
$component.Content = $component.Content.Replace("<linkText>a</linkText>", "<linkText>b</linkText>")

$component.Content 
$readBackOptions = New-Object Tridion.ContentManager.CoreService.Client.ReadOptions
pause
$client.Update($component, $readBackOptions)

以上是关于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服务