Using api get all the field's information for a custom dynamic module.
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!!!
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;
Great!!! Thanks Svetoslav.