get photos from Photosets in vb.net

Jul 6, 2007 at 8:41 PM
hi I can't seem to get my code to pull photos from a photosetid

Public Shared Function PhotoBySet()
Dim flickr As New FlickrNet.Flickr()
'Dim arrNames(1) As String
Dim arrNames = "72157600674015648"
'arrNames(1) = "72157594162136485"

Dim photos As FlickrNet.Photos = flickr.PhotosetsGetPhotos(arrNames)

If photos.PhotoCollection Is Nothing Then
Return New FlickrNet.PhotoCollection()
Else
Return photos.PhotoCollection
End If

End Function

Error: Compiler Error Message: BC30311: Value of type '1-dimensional array of FlickrNet.Photo' cannot be converted to 'FlickrNet.Photos'.

What am I doing wrong?

Is there documentation on all the functions syntax anywhere? It is so hard to figure out the syntax to this library. I don't have Visual Studio to run the ndoc stuff. In your examples, you only have a couple of examples but nothing about photosets.

Thanks.
Coordinator
Jul 12, 2007 at 2:55 PM
Edited Jul 12, 2007 at 2:56 PM
Finally spotted the problem. PhotosetsGetPhotos isn't returning a Photos instance, but an array of Photo instances.

The Photos class has a property called PhotoCollection which is the array of Photo instances, so hence the problem you are seeing.

This is probably wrong and not in line with the other methods which returns arrays of Photo instances, but historically you couldn't page PhotosetsGetPhotos so the parent properties of 'page' and 'total' weren't needed.

Public Shared Function PhotoBySet()
        Dim flickr As New FlickrNet.Flickr()
        Dim arrNames = "72157600674015648"
 
        Dim photos As FlickrNet.Photo() = flickr.PhotosetsGetPhotos(arrNames)
 
        If photos Is Nothing Then
            Return New FlickrNet.PhotoCollection()
        Else
            Return photos
        End If
 
End Function