More in this section
Forums / General Discussions / removing an item from ILibrary programatically

removing an item from ILibrary programatically

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 1 answered
  1. Josh
    Josh  avatar
    25 posts
    Registered:
    28 Apr 2009
    20 Oct 2010
    Link to this post
    Hi,

    I was wondering how to remove an item from an ILibrary programatically. Its not working.

    LibraryManager libraryManager = new LibraryManager(DEFAULT_NEWS_RELEASE_LIBRARY_PROVIDER);
    ILibrary NewsReleaseInTranscation = libraryManager.GetLibrary(myGuid);
    NewsReleaseInTranscation.GetItems().RemoveAt(index);
    libraryManager.SaveLibrary(NewsReleaseInTranscation);

    I tried using both remove and removeAt methods without any success.  Please help.

    Regards,

    Josh
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Oct 2010
    Link to this post
    Hello Josh ,

    There are methods of LibraryManager class that you can use

    • DeleteLibrary - deletes a library
    • DeleteContent - deletes an IContent object (item) from a library.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Josh
    Josh  avatar
    25 posts
    Registered:
    28 Apr 2009
    20 Oct 2010
    Link to this post
    Thanks Ivan,

    I actually found that method 30 minutes afterwards.

    Regards
Register for webinar
3 posts, 1 answered