Developer forum

Forum » Development » Add field to existing Item

Add field to existing Item

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

I know we can use CodeFirst to create new items, but I am wondering if/how we can use the API to add fields to an existing Item. Is that possible?

 

My goal is to build a dll that adds some fields in an existing Item (i.e. Custom tab from Rapido), so that we don't have to manually create them.

(this assembly is used regularly and is expecting some specific item field systemnames, so it's important to get it right)

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Pedersen
Reply

You might be able to use the API, but it is not a scenario we designed for, so it is probably not easy. You can take a look at the UI code in /admin in source control and see how it is done...

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

I knew it was a long shot. Would have been nice for my customizations, so we could look for a specific item type and generate the fields. Come to think of it, it would make it so much easier on deploying work between environments since it would just work, instead of relying on the deployment tool for some of this.

 

In any case, I followed your advice and go to \Admin\Content\Items\ItemTypes\ItemTypeEdit.aspx.vb and there's a method called SaveItemType() but it's not only private, but also relies on the UI to have preloadded the list and submits as json. I don't think it's in any way we could simply use it.

 

If something like this ever becomes publicly available, I am sure we'd use it, more than we do Code-First for Items.

 

Thanks you anyway,

Nuno Aguiar

 

You must be logged in to post in the forum