Home > APIs > AppServer API > Examples > Asset Management > Get Asset Properties
Get Asset Properties
The IMediaMgr::GetProperty function can be used to return one or more asset properties. Click here for a list of all asset properties.
Note that if you need to get multiple properties it is more efficient to make one GetProperty call for all properties rather than multiple GetProperty calls for each property.
[C#] IMediaMgr mediaMgr = iappServer.CreateMediaMgr(appName); // get a single property string assetType = (string) mediaMgr.GetProperty("edl/cmf//local/V:/default/Clip", "assetType"); Console.WriteLine("asset type = " + assetType); // get multiple properties object[] results = (object[]) mediaMgr.GetProperty("edl/cmf//local/V:/default/Clip", "LengthStr+videoCompressionType+videoFormatStr"); foreach (object obj in results) { Console.WriteLine("obj = " + obj); } // cleanup mediaMgr.Dispose();
[C++] IMediaMgrPtr spMediaMgr; hr = spAppServer->CreateMediaMgr(_bstr_t("YourApplicationName"), &spMediaMgr); VARIANT varResult; // get a single property hr = spMediaMgr->GetProperty(_bstr_t("edl/cmf//local/V:/default/Clip"), _bstr_t("assetType"), &varResult); CString sAssetType = varResult.bstrVal; printf("asset type: %s\n", sAssetType); // get multiple properties hr = spMediaMgr->GetProperty(_bstr_t("edl/cmf//local/V:/default/Clip"), _bstr_t("LengthStr+videoCompressionType+videoFormatStr"), &varResult); SAFEARRAY *pArray = varResult.parray; VARIANT *pVar = NULL; long arrIndex[1]; // get the first property arrIndex[0] = 0; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); CString sLength = pVar->bstrVal; // get the second property arrIndex[0] = 1; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); CString sVideoCompressionType = pVar->bstrVal; // get the third property arrIndex[0] = 2; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); CString sVideoFormat = pVar->bstrVal; printf("Length: %s VideoCompressionType: %s VideoFormat: %s\n\n", sLength, sVideoCompressionType, sVideoFormat);