Tuesday, 17 January 2017

Umbraco 7.X Get Prevalues from NodeId and Property Alias

Prevalues are where you can store configuration details you may want to use in backend code, such as url for a particular service etc....

Well this is how to get the Prevalues in C#.

var node = ApplicationContext.Services.ContentService.GetById(nodeId);
var propertyTypeTextExtractor = node.PropertyTypes.First(x => x.PropertyEditorAlias == "MyAlias");
int DataTypeID = propertyTypeTextExtractor.DataTypeDefinitionId;
XPathNodeIterator preValueIterator = umbraco.library.GetPreValues(DataTypeID);

No comments:

Post a Comment

Comments are welcome, but are moderated and may take a wee while before shown.