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)
Collection object Properties
Phead2
I'm having a little bit of trouble using collection objects (MBPSCRIPTMODEL2Lib.MBObjectCollection). The API guide refers to an Item property yet when I try to use the Item property I get an error because there is no definition for Item in MBPSCRIPTMODEL2Lib.MBObjectCollection. It seems all I can do is get a count of the items in the collection.
So, I can create collections but I do not see how to actually use their contents; anyone have any details on this?
Find more posts tagged with
Comments
msnider
While iterating over the collection, cast each object to the specific class you are dealing with. For example,
MBPSCRIPTMODEL2Lib.MBObjectCollection assets = container.get_AssetChildren( MBPSCRIPTMODEL2Lib.MBRepositoryItemType.AllAssetItems );
assets.Sort(MBPSCRIPTMODEL2Lib.MBSortField.ByAssetName, MBPSCRIPTMODEL2Lib.MBSortOrder.MBAscending, null);
IEnumerator i = assets.GetEnumerator();
while( i.MoveNext() )
{
MBPSCRIPTMODEL2Lib.MBAsset asset = (MBPSCRIPTMODEL2Lib.MBAsset) i.Current;
string assetName = asset.Name;
}
Mark