In one of my plugins I have a requirement to download and add photos from the remote server and populate the newly created published collection in Lightroom. In this routine, I use the following code to add the images to a published collection using the method provided by Don above.

[code]

catalog:withWriteAccessDo('createcollection', function()

newcollection = v:createPublishedCollection(h.title)

newcollection:setRemoteId(h.id)

end)

catalog:withWriteAccessDo( 'NPGSetUpdates', function()

newphoto = catalog:addPhoto(newpath)

newcollection:addPhotoByRemoteId(newphoto,p.id,p.url,true)

end)

[/code]

The biggest thing here is that adding a photo like this requires the code to reside within the withWriteAccessDo block.

I have a "Mark As Published" feature for all my publishing services now. The trick for me has been determining the published collection to add to. In your case, it's the one you just created, but it's not always that simple...