I'm wring a PowerShell script to change objects metadata at once. My script woks properly for topic objects. However, it does not work for image objects. I wrote the following code to change metadata using DocumentObj 2.5.
I'm wring a PowerShell script to change objects metadata at once. My script woks properly for topic objects. However, it does not work for image objects. I wrote the following code to change metadata using DocumentObj 2.5.
Hi Naoki,
Nice to see you write PowerShell scripts on the (deprecated) ASMX-SOAP API functions using INTERNAL authentication. Where INTERNAL refers to that the Docs CMS user profile holds the password.
The number '-102003' uses the following error description "The {objecttype} "{object}" cannot be returned, because it is not initialized." where the two parameter mentioned (so {...}) are filled in in your runtime.
I will guess that you did not offer a value for "$resolution" - like Low, High, Default,... - so in turn you didn't specify an exact object that the system can work on.
I cannot really derive which Tridion Docs version (like 14SP3/14.0.3) you are using? I do wonder why you decide not to use ISHRemote, see https://github.com/sdl/ISHRemote
[...]
New-IshSession -WsBaseUrl "">https://example.com/ISHWS/" -PSCredential "Admin"
$ishTopicMetadata = Set-IshMetadataField -Name "FTITLE" -Level Logical -Value "Topic $timestamp" |
Set-IshMetadataField -Name "FAUTHOR" -Level Lng -ValueType Element -Value $ishUserAuthor |
Set-IshMetadataField -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusDraft
$ishObject = Add-IshDocumentObj -FolderId $ishFolderTopic.IshFolderRef -IshType ISHModule -Lng $ishLng -Metadata
$ishTopicMetadata -FileContent $ditaTopicFileContent
$ishObject = Set-IshDocumentObj -IshObject $ishObject -Metadata (Set-IshMetadataField -IshSession $ishSession -Name
"FSTATUS" -Level Lng -ValueType Element -Value $ishStatusReleased)[...]
Umm, it's difficult.
I'm trying to get/set object's metadata based on object id (i.e. GUID) and its version. Therefore, I created a CSV file that contains GUID and its version of objects as shown below.
GUID-CA754C5A-A4FC-44E4-9BA9-7A7EC19215E3,1
GUID-806E1FE4-083A-4B45-A9F1-6177A987EBB7,1
GUID-DDF07E67-29C7-49DF-8676-90C1AD9A311E,1
In the PowerShell script, I want to process each object by finding the object using Find-IshDocumentObj. However, it seems specifying GUID for Set-IshMetadataFilterField is not possible. How do I process each document object base on the GUID?
In essence the ASMX-SOAP and WCF-SOAP are equal regarding business calls, but differ in the security paradigm they respect. So I'm not forcing you into ISHRemote. Some background on the API and its future is available here: https://community.sdl.com/product-groups/sdl-tridion/tridion-docs/m/videos/4533
As I developed on ISHRemote I think it does its best to wrap WCF-SOAP in a PowerShell pipeline object friendly way. The ASMX-SOAP will force you more in raw xml structures.
On the essence, finding one object by GUID. That is actually the main difference between a Find-* and Get-* cmdlet, with Find-* you do not know the identifier, with Get-* you do (as in your scenario). So regarding the last piece of code, what about:
$metadataFilter = Set-IshMetadataFilterField -Level Version -Name VERSION -FilterOperator Equal -Value $cur_version |
Set-IshMetadataFilterField -Level Lng -Name DOC-LANGUAGE -FilterOperator Equal -Value $lang
Get-IshDocumentObj -LogicalId $cur_GUID -MetadataFilter $metadataFilter
# and ISHRemote already takes care of the returned object in pretty-print for you and retrieves a bunch of nice descriptive fields for you
And on https://github.com/sdl/ISHRemote are some extra links, also ISHRemote repects the Get-Help some-cmdlet principle with examples.
In essence the ASMX-SOAP and WCF-SOAP are equal regarding business calls, but differ in the security paradigm they respect. So I'm not forcing you into ISHRemote. Some background on the API and its future is available here: https://community.sdl.com/product-groups/sdl-tridion/tridion-docs/m/videos/4533
As I developed on ISHRemote I think it does its best to wrap WCF-SOAP in a PowerShell pipeline object friendly way. The ASMX-SOAP will force you more in raw xml structures.
On the essence, finding one object by GUID. That is actually the main difference between a Find-* and Get-* cmdlet, with Find-* you do not know the identifier, with Get-* you do (as in your scenario). So regarding the last piece of code, what about:
$metadataFilter = Set-IshMetadataFilterField -Level Version -Name VERSION -FilterOperator Equal -Value $cur_version |
Set-IshMetadataFilterField -Level Lng -Name DOC-LANGUAGE -FilterOperator Equal -Value $lang
Get-IshDocumentObj -LogicalId $cur_GUID -MetadataFilter $metadataFilter
# and ISHRemote already takes care of the returned object in pretty-print for you and retrieves a bunch of nice descriptive fields for you
And on https://github.com/sdl/ISHRemote are some extra links, also ISHRemote repects the Get-Help some-cmdlet principle with examples.
I'm getting familiar with ISHRemote and PowerShell. I succeeded to obtain objects metadata based on object's GUID and version. This could be achieved with your kind assistance. Thanks a lot, Dave!
Now, it's possible to add or modify metadata using Excel. My next task is writing a PowerShell script that overwrite objects metadata. As the result, we'll be able to add or modify metadata for a publication at once.