Aug 7, 2010 at 5:48 PM
Edited Aug 8, 2010 at 9: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.
Public Class _Default
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")
lblsets.Text = GetCollections(Scol)
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>"