Skip to main content
Participant
February 26, 2012
Answered

deletePublishedCollection : No info.photoIds

  • February 26, 2012
  • 1 reply
  • 1613 views

Hello,

I'm trying to use deletePublishedCollection function.

However i don't retrieve  info.photoIds . I have always nil in this element of info structure.

I did'nt retrieve in the documentation that this element of structure exist. But all examples are using it ???

I don't understand.

Do I do initialize something when I did the export as i did it to retrieve info.remoteId ? 

some help will be pleasant

The code I copyed from sample (ZenPhoto/Flicker) isbelow  (I reduced in maximum the function and delte all test. But I never go inside the 'for' loop)

function publishServiceProvider.deletePublishedCollection( publishSettings, info )

import 'LrFunctionContext'.callWithContext( 'publishServiceProvider.deletePublishedCollection', function( context )

   

        local progressScope = LrDialogs.showModalProgressDialog {

                            title = LOC( "$$$/Chouette38/DeletingCollectionAndContents=Deleting photoset ^[^1^]", info.name ),

                            functionContext = context }

                           

            for i, photoId in ipairs( info.photoIds ) do

                Chouette38API.deletePhoto( publishSettings, { photoId = photoId } )

            end

        end )

end

This topic has been closed for replies.
Correct answer DawMatt

Hi,

John has answered question 2. As to question 1, that looks like an error in

the sample code. Hopefully it will be fixed soon.

Thanks, Matt

(Apologies for the brevity - sent from my Android)

1 reply

DawMatt
Inspiring
February 26, 2012

Hi,

If you look at the documentation for the deletePublishedCollection() callback you are using, the info table does not contain a photoIds field.

To get the list of images you are looking for I think you will need to use something like:

     info.publishedCollection:getPhotos()

or

     info.publishedCollection:getPublishedPhotos()

Matt

hibou38Author
Participant
March 2, 2012

I undestand but two things:

1) It was similar to the samples provided inside the SDK (Flickr sample)

function publishServiceProvider.deletePublishedCollection( publishSettings, info )

     import 'LrFunctionContext'.callWithContext( 'publishServiceProvider.deletePublishedCollection', function( context )

            local progressScope = LrDialogs.showModalProgressDialog {

                            title = LOC( "$$$/Flickr/DeletingCollectionAndContents=Deleting photoset ^[^1^]", info.name ),

                            functionContext = context }

            if info and info.photoIds then

                    for i, photoId in ipairs( info.photoIds ) do

                            if progressScope:isCanceled() then break end

                            progressScope:setPortionComplete( i - 1, #info.photoIds )

                FlickrAPI.deletePhoto( publishSettings, { photoId = photoId } )

                        end

                end

            if info and info.remoteId then

                FlickrAPI.deletePhotoset( publishSettings, {

                                photosetId = info.remoteId,

                                suppressError = true,

                                    -- Flickr has probably already deleted the photoset

                                    -- when the last photo was deleted.

                            } )

            end

                end )

end

2)With LrPhoto object I don't know how to retrieve the remoteID of the phototo  be deleted.

JM

johnrellis
Legend
March 3, 2012

info.publishedCollection:getPublishedPhotos() returns an array of LrPublishedPhoto.  publishedPhoto:getRemoteId() returns the remote id.