Jump to content

Collection Manager RemoveFromCollection


Go to solution Solved by Luke,

Recommended Posts

bakes82
Posted

Whats the way to get a  box set to pass in to the RemoveFromCollection method?  The rest api just takes in the internal id which is what Im passing to the GetItemById method

var existingCollection = _libraryManager.GetItemById(collection.CollectionId);
        _collectionManager.RemoveFromCollection(existingCollection as BoxSet, mediaItems.Select(x => x.InternalId)
                                                                             .ToArray());
No collection exists with the supplied Id
   at Emby.Server.Implementations.Collections.CollectionManager.RemoveFromCollection(BoxSet collection, Int64[] itemIds)
Posted
Quote

collection.CollectionId

What is the collection object?

bakes82
Posted
4 minutes ago, Luke said:

What is the collection object?

The "collection" object is my custom class, the collectionId is the long - internal id that you need to use to pass in to _collectionManger.AddCollection, and to delete a collection you use the BaseItem from GetItemById its weird this remove from collection takes in a boxsex, so I need the magic to get a boxset item from a internal long id

  • Solution
Posted

The message of the exception that gets thrown is outdated, and that will be fixed, but what is happening is you passed in null.

Logging will probably be needed to capture what is being passed into GetItemById, making sure it's non-zero, as well as what comes out of that.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...