5 Replies Latest reply on Mar 3, 2012 2:04 AM by hibou38

    deletePublishedCollection : No info.photoIds

    hibou38

      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

        • 1. Re: deletePublishedCollection : No info.photoIds
          DawMatt Level 3

          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

          • 2. Re: deletePublishedCollection : No info.photoIds
            hibou38 Level 1

            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

            • 3. Re: deletePublishedCollection : No info.photoIds
              johnrellis Most Valuable Participant

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

              • 4. Re: deletePublishedCollection : No info.photoIds
                DawMatt Level 3

                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)

                • 5. Re: deletePublishedCollection : No info.photoIds
                  hibou38 Level 1

                  Thank you for your answers.

                   

                  Of course it works !

                   

                  Merci beaucoup

                   

                  JM