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)
Set MetaData Values in 4.0
System
I'm trying to set the value of an Assets MetaData in MB 4.0. After the code executes, I check the asset's MetaData, and nothing changed. Does anyone have any ideas as to what could be going wrong? I've included a code snippet below.
Thanks!
Set objAsset = mediaBinServerObject.GetAsset(strTargetId)
' Update metadata of asset with approved info
Dim MD_ID_Approved
Dim objDataValue, objMetadata, objMDDefinition
Dim colMetadata
Set colMetaData = mediaBinServerObject.CreateObjectCollection
MD_ID_Approved = MetaDataId("Approved")
Set objMDDefinition = mediaBinServerObject.GetMetaDataDefinition(MD_ID_Approved)
Set objMetaData = objMDDefinition.CreateMetaDataValue
Set objDataValue = mediaBinServerObject.CreateDataValue
objDataValue.Value = True
objMetadata.SetValue objDataValue
colMetadata.Add objMetadata
objAsset.ReviseMetadata colMetadata
Find more posts tagged with
Comments
Migrateduser
Are you sure that the code you posted executed successfully? I was not able to get it to run in 4.0, as it looks suspiciously 3.0-like.
I modified it and got it to work. You will have to change the ID of the asset whose metadata you want to update.
The updated metadata is "Author"
Dim objAsset
Set objAsset = MBSession.GetAsset("{60766BCF-66BC-4A78-9F17-F3F87C75628D}")
' Update metadata of asset
Dim objMetadata
Dim colMetadata
Set colMetaData = MBSession.CreateObjectCollection
Set objMetaData = MBSession.CreateMetaDataValue ("{E94A2180-582A-11D4-8104-0050DA27F4FC}", "Test")
colMetadata.Add objMetadata
objAsset.ReviseMetadata colMetadata
Folco