Developer forum

Forum » CMS - Standard features » Get Item of Area in DW8

Get Item of Area in DW8

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a data integration notification (OnJobCompleted) where I need to read a property of the Area ItemType.

What is the easiest way to get that property? I know in DW9 there are some methods that ease access to the ItemProperties but I am not sure what's the best approach in DW8.

Thank you,

Adrian


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Adrian,

You don't specify which version of DW8 you're using, so I'll assume it's one of the newer ones.

If you have an ID of the area, you can use the Dynamicweb.Content.Area.GetAreaById method to get the Area. Once you have that, the ItemId and ItemType properties contain the information you need to pass to Dynamicweb.Content.Items.ItemManager.Storage.GetById(<ItemType>, <ItemId>). This will give you the Item belonging to the Area and you can read the property by using the indexer as normal: areaItem[<PropertyName>].

I hope this helps.

- Jeppe

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Jeppe,

You are right, it's one of the new ones. I thought it won't make a difference.

I was hoping for a more straightforward approach. Something like  Area.Item that would return the Item directly.

But I can use this approach since you recommended it :)

Thank you very much.

Adrian

 

You must be logged in to post in the forum