Developer forum

Forum » Development » Create NamedItemList from code

Create NamedItemList from code

Andrey Kozachuk
Reply

Is it possible to create NamedItemList and attach it to a page with given ID in the code of a notification subscriber?

P. S.

Is there a documentation about adding and removing items from existing lists?


Replies

 
Vladimir
Reply

Hi Andrey,

yes it is possible:

            var list = new NamedItemList();
            list.Save(name, itemType, NamedItemList.ListSourceType.Page, pageID);
            list.ItemList.Relations = items;
            list.ItemList.Save();

to add/remove items from existing list:

            ItemList.DeleteRelation(namedListId, itemId);
            ItemList.AddRelation(namedListId, itemId, sortIndex);

Best regards,

Vladimir

 

You must be logged in to post in the forum