Collection showing even though all Photos Private

Aug 7, 2010 at 4:48 PM
Edited Aug 8, 2010 at 8:28 AM


I have several Collections with sets in my account. One of my Collections contains one Set. All the photos in that set are private. If I try to click on that Collection to show the set in that collection the code errors stating that there are no photosets at the point highlighted in green in the code below.

This happens if I am authenticated (eg have a entered the token) or not.

Viewing the same in Flickr, if I am not logged in, I do not see the collection and therefore the set, as I assume Flickr knows that there are no publicly visible photos in the collection. This doesn't happen using the code below - it shows all the collections.

Interestingly, you will see that the there is a msgbox above the code - this returns the correct setid.

So there seems to be two issues:

- How to not display the collection if all the photos in the collection/set are private, when you are not authenticated.

- How to access the collection if you are authenticated.



Imports Flickr

Public Class _Default
    Inherits System.Web.UI.Page
    Dim f As New Flickr()
    Private fUserId As String = "***"
    Private fToken As String = "***"

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'f.AuthToken = fToken
        Dim Scol As String
        If Request.QueryString("col") = "" Then
            Scol = 0
            Scol = Request.QueryString("col")
        End If
        lblsets.Text = GetCollections(Scol)
    End Sub

    Function GetCollections(ByVal iCollection As String) As String
        Dim sOutput As String = ""
        Dim fcolCol As CollectionCollection = f.CollectionsGetTree(iCollection, fUserId)
        If fcolCol.Count = 1 Then
            'There is no collections - show sets instead.
            For Each col As Collection In fcolCol
                For Each colSet As CollectionSet In col.Sets
                    Dim phset As PhotosetPhotoCollection = f.PhotosetsGetPhotos(colSet.SetId)
                    Dim photoInfo As PhotoInfo = f.PhotosGetInfo(phset.PrimaryPhotoId)
                    sOutput &= colSet.Title & "<a href=""default.aspx?set=" & colSet.SetID & """><img border=""0"" src=""" &_
				 photoInfo.SquareThumbnailUrl & """></a><br>"
            'Show the Collections
            For Each phcol As Collection In fcolCol
                sOutput &= phcol.Title & "<a href=""default.aspx?col=" & phcol.CollectionId & """><img border=""0"" src=""" &_
				 phcol.IconLarge & """></a><br>"
        End If
        Return sOutput
    End Function
End Class



Aug 8, 2010 at 8:27 AM

I have just had another look this morning. I reset all the photos in this one set to private and the collection disappeared from the main list, as you would expect.

I then set all photos public as a test, and the collection didn't re-appear. Checking on the Flickr site as public user shows the collection.

If I go to my page and enter the querystring in the URL with the collectionID, it shows up no problem - so it looks like there is some issue with listing the collection when there are private/public changes to the photos

Aug 9, 2010 at 8:04 AM
The Flickr.Net library should be returning exactly what is returned by the Flickr API, unless caching is causing your problem. You could try turning off the Cache (set Flickr.CacheDisabled = true). If that doesn't solve the problem then test your scenarios against the Flickr API Explorer. If there is still a difference between what the Flickr API is returning and the .Net library, then please let me know. Sam
Aug 9, 2010 at 12:35 PM


I think it is Cache related as later in the day it was displaying OK. I have disabled the cache for now.

Thanks for your work on this project though - it is a great piece of work!!