Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Convert single page PageType to another PageType programically

Vote:
 

Hello,

i found the topic https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2018/5/convert-page-type-to-another-page-type-programmatically/ where there is described that we could migrate single page to another pagetype.

My question is --> there is talking about " List<KeyValuePair<int, int>> propertyTypeMap" . How could get this one? I mean it's strange that we are using int instead of string (since i don't know how to get int of my propertyname in my page).
Is there some kind of epi method that i could get Page property int value ??

#200945
Jan 31, 2019 12:58
Vote:
 

You can use IPropertyDefinitionRepository to list all properties for a page type.

var pageTypeId = 10;
var propertyDefinitions = propertyDefinitionRepository.List(pageTypeId);
var property = propertyDefinitions.FirstOrDefault(x => x.Name == "NameOfProperty");
var propertyId = property.ID;
#200950
Edited, Jan 31, 2019 14:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.