Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Script: Search for Asset file name
System
Hi All,
How can I perform a simple search for an image file name? This is what I have and the error below. Any help is greatly appreciated.
Dim objRoot As MBContainer
Dim objSearchCriteria As MBSearchCriteria
Dim objSearchConstraint As MBSearchConstraint
Dim colSearchResults As MBObjectCollection
MBSession.Logon MY_SERVER, MY_AD, MY_LOGIN, MY_PASSWORD, 32456
Set objRoot = MBSession.GetContainer("{60F92FC7-DB23-4A34-BFFE-740902D19CBE}")
Set objSearchConstraint = MBSession.CreateMetaDataCompareSearchConstraint(LOUPE_IDENTIFIER, SearchContains, "loupe") 'jpg
Set objSearchCriteria = MBSession.CreateConstraintSearchCriteria(objSearchConstraint)
Set colSearchResults = objRoot.FindAllAssets(objSearchCriteria) ' Error occurs here.
'?err.Number
'-2147220473
'?err.Description
'The value passed in is not valid for the parameter
MBSession.Logoff
Set MBSession = Nothing
Find more posts tagged with
Comments
msnider
What is the value of LOUPE_IDENTIFIER? It should be the GUID of the "Name" system metadata which is"{B297C571-F083-11D4-8200-0060080D8AC2}".
Mark
Migrateduser
Hi Mark,
Yikes, that's what it was, I had the wrong GUID. How can I determine the metadata GUIDs, I queried the db directly, but could not find the metadata identifiers, thus I go to the metadata manager on the web site, edit a piece of metadata and then "view source." What is the better way?
Thanks for your help, Mark; I very my appreciate it!
Stacy
msnider
There are several ways you can get the metadata ids:
1.) If you have the MediaBin WebService installed, you can call GetSearchableMetadata to get the complete list of system and custom metadata available to search.
2.) If the metadata is custom, you can export the metadata definition as an XML file from either the native windows client or the web client and then look for the <ID></ID> tag.
3.) For both system and custom metadata, you can use the web client. Go to the metadata manager and choose to edit the metadata. From the "Edit Metadata Definition" window, view the source and look for the "MetaId" field.
Mark
Migrateduser
Thank you Mark. Very helpful!