0

How do I retrieve the list of localised components based on a particular schema using the TOM API?

Update: This is resolved..!!!

This is my script that works:

    Option Explicit
On Error Resume Next
Dim objTDSE
Set objTDSE = CreateObject("TDS.TDSE")
objTDSE.Initialize

Dim objSchema
Set objSchema= objTDSE.GetObject("tcm:12-19422-2", 1)
'Set objSchema= objTDSE.GetObject("tcm:12-47-8", 1)

Dim lObjRowFilter
Set lObjRowFilter = ObjTDSE.CreateListRowFilter() 
'Call lObjRowFilter.SetCondition("BasedOnSchema", "tcm:5-19764-8")
Call lObjRowFilter.SetCondition("ItemType", 16)
Call lObjRowFilter.SetCondition("Recursive", True)
'Call lObjRowFilter.SetCondition("LockUser", lObjTDSE.User) 

Dim doc
Set doc = CreateObject("Microsoft.XMLDOM")
doc.async = false
doc.ValidateonParse = False
doc.resolveExternals = False

doc.LoadXml(objSchema.getlistitems(15, lObjRowFilter) )
doc.save "D:\temp\Content Extract\SR3741354\ICP_CompList.xml"

If err.number <> 0 Then 
   MsgBox "Error : " & err.description
End If
MsgBox "Done !!"

set doc = Nothing 

Earlier: Option Explicit On Error Resume Next Dim objTDSE Set objTDSE = CreateObject("TDS.TDSE") objTDSE.Initialize

Dim objFolder
Set objFolder= objTDSE.GetObject("tcm:12-17275-2", 1)
'Set objFolder= objTDSE.GetObject("tcm:12-47-8", 1)

Dim lObjRowFilter
Set lObjRowFilter = ObjTDSE.CreateListRowFilter()
Call lObjRowFilter.SetCondition("BasedOnSchema", "tcm:5-19764-8") 
'Call lObjRowFilter.SetCondition("Recursive", True)
'Call lObjRowFilter.SetCondition("ItemType", 16)
'Call lObjRowFilter.SetCondition("LockUser", lObjTDSE.User) 

Dim doc
Set doc = CreateObject("Microsoft.XMLDOM")
doc.async = false
doc.ValidateonParse = False
doc.resolveExternals = False

doc.LoadXml(objFolder.getlistitems(15, lObjRowFilter) )
doc.save "D:\temp\Content Extract\SR3741354\ICP_CompList.xml"


If err.number <> 0 Then 
    MsgBox "Error : " & err.description
End If
MsgBox "Done !!"

set doc = Nothing 

Any help would be appreciated.

  • The code that you say is working is still pretty confusing to read. The variable that references the folder is called objSchema – Dominic Cronin Jul 8 '15 at 19:38
0

As Andrey says, your schema is a folder, but that's just a naming error. The code as written should filter the components to only show up if they are based on that schema. My suspicion is that you haven't got any components based on the schema in your test folder.

If you put your item type filter back, that should get rid of the folders. Don't forget that you can't use BasedOnSchema in combination with Recursive.

It's not clear exactly what you're trying to do, but you might be better off with a where-used query. You need to look at the Info object of the Schema, and then use GetListUsingItems().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.