I think you want to post this in the Photoshop Lightroom forum (this is the Lightroom SDK forum, for plugin authors).
Or have I misunderstood the question? (collection:getParent() to get parent in lua code).
Or are you trying to call the catalog function to create a collection, but don't know what to use for parent collection set? If this is the case, then you will have to create a collection set if you can't find something suitable to act as parent (e.g. a selected collection set obtained from catalog:getActiveSources()). Reminder: parent parameter is optional - if omitted, then collection will be created in root of catalog (or publish service) - that's another option.
Most of my plugins that create collections create a collection set in the root, named after the plugin, and put all sub-collections/sets in it.
I want to create collection under "BatchUpload" folder. But Lightroom always create it from root.
Thanks so much.
Are we talking about lua plugin code?
If so, just call catalog:getChildCollectionSets() and visit each until you find BatchUpload.
How to know collectionset is parent of new collection.
You must supply the parent collection set when you create the collection. Whichever collection set you pass, will be the parent of the new collection.
When iterating the catalog's child collection sets, you can look at the collection set name to see if it's the right one, assuming you will know the correct name when you see it - will you always?
Consider posting actual code snippets if you can.
function publishServiceProvider.updateCollectionSettings( publishSettings, info )
local pubcol = LrCatalog:getPublishedCollectionByLocalIdentifier( info.publishedCollection.localIdentifier )
local parent = pubcol:getParent()
-- parent is nil when i create new collection
If parent is nil then parent is root. Make sure when you create the collection, that you are passing a valid collection set as parent, if you don't want it created in the root.
In the code you posted, you are not actually creating a collection, but rather getting a reference to an already existing collection, which was created in the root of the publishing service.
Do you also have the code that is creating the collection?
Please post to me code to create the collection.
thanks so mutch
Do you have the SDK API doc? - these are from the top of the page about publish services:
publishService:createPublishedCollection( name, parent, canReturnExisting )
Creates a new published collection in this publish service.
publishService:createPublishedCollectionSet( name, parent, canReturnExisting )
Creates a new collection set in this publish service.
publishService:createPublishedSmartCollection( name, searchDesc, parent, canReturnExisting )
Creates a new published smart collection in this publish service.
I couldn't get parent to use these function. How to get parent to use it?
I think you are going to have to try and state the problem more clearly.
When I create 1 collection in lightroom then i need check name of new collection in my system.
I need send parent, name to check it.
But I couldn't get parent.
Do you want the parent of the collection to be the collection set named 'BatchUpload'?
In any case, you need to determine the parent before creating the collection. If the parent does not already exist, then you need to create it. If the parent does already exist, then you need to find it, by rummaging through existing collection sets.
Note: if the target collection set may be nested, you may need to use recursion to find it, since there is no method to get a complete list of all collection set children.
Thanks for your helping
You're welcome - although I don't know how much I helped. I hope you get it working, if you haven't already...
In getCollectionBehaviorInfo function, i disable "create collection set".
So, parent is alway root.
Okay - I see now. Thanks for letting me know .