Joined: 2/14/2008 Posts: 482
|
I would like to get all the dms uploaded assets from a folder. Only DMS uploaded assets not the html content or content of any other type under the folder using API. Is it possible using any API?
And also would like to check the filename and extension of the file. Is there a api to see the filename of the asset?
1. Currently, I am using below code for getting child content from folder and scannign through each contentdata object looking for title or filename match and extension match for files... but if I have mixed content teype in the folder, this is not an efficient way of checking. So looking for specific api that can get me all the child dms uploaded asset data only.
2.In my below code, contentdata object's filename is always empty for some reason, is there a way to get filename of the dms uploaded asset ?
,
****************
Private Function assetExists(ByVal strAssetName As String, _ ByVal sAssetExt As String, _ ByVal assetFolderId As Long, _ ByRef aAssetID As Long) As Boolean 'assetFolderId=81, strAssetName="AdminQuick", sAssetExt="pdf" Dim contentApi As New Ektron.Cms.API.Content.Content Dim arrcontentdata() As Ektron.Cms.ContentData Dim bExists As Boolean = False arrcontentdata = contentApi.GetChildContent(assetFolderId, True)If arrcontentdata IsNot Nothing AndAlso arrcontentdata.Length > 0 Then For Each acontentdata As Ektron.Cms.ContentData In arrcontentdata If (acontentdata.Title.ToString.Trim = strAssetName Or acontentdata.AssetData.FileName.Trim = strAssetName) AndAlso _ acontentdata.AssetData.FileExtension.Trim = sAssetExt Then 'file exists in cms(filename or title is same and also extension is same) 'If acontentdata.AssetData.FileExtension.Trim = sAssetExt AndAlso _ ' acontentdata.AssetData.MimeType.Trim = "application/pdf" Then 'End If aAssetID = acontentdata.Id 'content id of the asset bExists = True Exit For End If Next End If Return bExists End Function
****************
|
Joined: 9/13/2006 Posts: 2367
|
Why not use a ListSummary? It supports setting the content type.
http://www.ektron.com/services/
|
Joined: 2/14/2008 Posts: 482
|
I need to know if file exists in CMS. So I go with file name, file extension, folder id etc... I won't have assetid here. So how we use listsummary control for this? I need to upload a file to cms using APIs and ask user if they want to overwrite if the file already exists in DB.
So I get file extension and the file title to check for this. But not filename itself...
So you are sayign I go with listsummary control by setting the content type to get only asset type content not any other content type.. can you please give me details on this.
thanks
|
Joined: 1/27/2010 Posts: 39
|
Try GetList where you can specify the filters of your own and will fit into your requirement. Explore this Ektron.Cms.Framework.Core namespace where you will have lot of options by specifying the criteria.
ContentAPI contentApi = new ContentAPI();
Criteria<ContentProperty>
criteria = new Criteria<ContentProperty>();
criteria.AddFilter(ContentProperty.Type, CriteriaFilterOperator.GreaterThanOrEqualTo,
EkEnumeration.CMSContentType.Assets);
criteria.AddFilter(ContentProperty.FolderId, CriteriaFilterOperator.EqualTo,
14);
List<ContentData>
contentList = contentApi.GetList(criteria);
|