EPiServer 7.5 Mvc Parsing ContentAreas

So this other day I had to get all values from a Page in EPiServer (7.5+) to send to another service. I’ve done it before in earlier versions and thought there would be no problem. However the new ContentArea breaks the pattern a bit and left me confused. Looping through the pageproperties, you could do a switch on the PropertyDataType enum to see what we were dealing with, but not in case of ContentArea it seems.

The funny thing is that there is no ContentArea in that enum and the ContentArea itself says, by Type, that it’s a LongString? So I try do a check on OriginalType and compare to PropertyContentArea, successfully I can identify the ContentArea property. It’s never fun having to compare types though..

What i need to do now is parse everything that is in that contentarea and get the properties for those items aswell. Don’t know how often you do stuff like this but it’s a rather special case and something that is also pretty tight cached, so should be no worries.

The GetExternalUrl() that i use are extensions to get pretty links, which i want from everything that is a PageReference or a ContentReference. This of course varies what you are using em for. But should give you the basic idea.