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.
newcollection = v:createPublishedCollection(h.title)
catalog:withWriteAccessDo( 'NPGSetUpdates', function()
newphoto = catalog:addPhoto(newpath)
The biggest thing here is that adding a photo like this requires the code to reside within the withWriteAccessDo block.