Using api get all the field's information for a custom d

Posted by Community Admin on 04-Aug-2018 16:19

Using api get all the field's information for a custom dynamic module.

All Replies

Posted by Community Admin on 15-May-2015 00:00

Hi,

Using api, is it possible to get all the field's field name & field type including related data for a given custom dynamic module ?

I poke around and found some information about the fields in DynamicModulesConfig.config but wondering if their is a api from sitefinity to get access of all those fields information.

Any information is helpful. 

Thanks!!!

 

Posted by Community Admin on 20-May-2015 00:00

Hello Uttam,

In order to get all the field of the content type you need you can use ​MetadataManager.

Below is a sample code snippet that you can use:

Type contentType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.MyModule1.MyContentType");
 
var metadataManager = MetadataManager.GetManager();
 
var contentMetaType = metadataManager.GetMetaType(contentType);
var fields = contentMetaType.Fields;
foreach (var field in fields)
    var fieldName = field.FieldName;
    var fieldType = field.ClrType;


Regards,
Svetoslav Manchev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 20-May-2015 00:00

Great!!! Thanks Svetoslav.

This thread is closed