Welcome close

We've made some changes!

As you may have noticed, we've made some changes to the DevCenter to include the new Exchange site, a code community for Ektron developers. You may use the same username and password to login for both the Exchange and DevCenter. Your DevCenter profile has moved over to the Exchange site. You also may notice we have removed some profile functionality in favor of new functionality, including Activity Streams. We welcome your feedback about the site on the Exchange forum.

SEARCH : searchSite
This SectionSite Wide
Version 8 

RSS Feed Print Category View
API to get only DMS documents recursively from a folder and check filename and extension, V8.0SP1
Vijayalakshmi
Posted: Friday, March 5, 2010 3:06 PM
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  

****************


eGandalf
Posted: Friday, March 5, 2010 5:34 PM
Joined: 9/13/2006
Posts: 2367


Why not use a ListSummary? It supports setting the content type.



http://www.ektron.com/services/


Vijayalakshmi
Posted: Friday, March 5, 2010 5:43 PM
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


Killer_Instinct
Posted: Sunday, March 7, 2010 2:29 PM
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);


 

Jump to different Forum... 






Register for Synergy 2010

Articles
Design without Borders, yet with Structure
CMS400.NET and Adobe Flex
GeoMapping
EkML Ektron Markup Language
Taxonomy

[First] [Previous] [Next] [Last]


See All Articles