roaku 795 Posted March 25, 2021 Share Posted March 25, 2021 I have a scenario where I have a BaseItem and want to find out if it is part of a collection with a given name. After deep diving on the forum, I've come up with something that seems to work: long[] collectionIds = _libraryManager.GetInternalItemIds(new InternalItemsQuery() { ListItemIds = new[] {item.InternalId}, Name = collectionName }); if (collectionIds.Count() > 0) { //our item is in the collection, so do something about it } But..I was hoping at least some collection information was stored somewhere directly on BaseItem, but that doesn't seem to be the case. Am I just missing something? If I do end up having to query for collection for every item, I'll probably try inverting things and and get the collection's children once and cache that result short term, then check each item against that cache. Link to comment Share on other sites More sharing options...
Luke 37049 Posted March 28, 2021 Share Posted March 28, 2021 Hi, yes you're on the right track there. Link to comment Share on other sites More sharing options...
roaku 795 Posted March 28, 2021 Author Share Posted March 28, 2021 Ok, thanks for the sanity check. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now