user3070481
user3070481

Reputation: 11

How to get all DataTypes including custom created data types in UMBRACO?

I would like to access all Data Types of UMBRACO through C# code including custom created Data Types. I can get all predefined data types from UMBRACO through ApplicationContext.Services.DataTypeService but not custom created data types.

Can anyone help me over here??

Thanks in advance.

Harshil Shukla

Upvotes: 1

Views: 1527

Answers (2)

antao
antao

Reputation: 767

You can use

var allDataTypeDefinitions = ApplicationContext.Services.DataTypeService.GetAllDataTypeDefinitions();

This will return you a IEnumerable with all the information of your data types.

More information here. Hope it helps.

Upvotes: 5

Emanuel
Emanuel

Reputation: 626

umbraco.cms.businesslogic.datatype.DataTypeDefinition[] dataTypes
  =  umbraco.cms.businesslogic.datatype.DataTypeDefinition.GetAll();

Upvotes: 0

Related Questions