Question regarding creating photosets

Topics: User Forum
Jan 3, 2011 at 4:55 PM


First off, thanks for a great API toolkit!

I am developing an ASP.NET app that will incorporate Flickr. Basically the idea is the org has a Flickr account, and will allow authenticated members to create PhotoSets and upload photos. Each member will have a single PhotoSet.

When the app starts, it makes an authenticated call (the Flickr site being incorporated is not public) to PhotoSetsGetList(userID) to populate a drop-down list allowing users to see all photosets that have been created. When the user selects a Photoset from the list it will display the photos in the set via a javascript slide show. This all works very nicely.

To create a PhotoSet, I have the following method:

public static string CreatePhotoSet(string PhotoSetName,string PhotoSetDescription)
            string newID = null;
            Flickr flickr = new Flickr(ConfigurationManager.AppSettings["apiKey"],
                ConfigurationManager.AppSettings["sharedSecret"], ConfigurationManager.AppSettings["token"]);
            PhotosetCollection sets = flickr.PhotosetsGetList(ConfigurationManager.AppSettings["defaultUser"]);
            //When you create a new photoset on Flickr, you must specify a primary photo. Since the user has not
            //uploaded any photos yet, we will use the primary ID of the first photoset photo. We will later set the
            //PrimaryID of the new photoset to the first picture the user uploads
            string primaryPhotoID = sets[0].PrimaryPhotoId;
            if (sets.CanCreate)
                Photoset set = flickr.PhotosetsCreate(PhotoSetName, PhotoSetDescription, primaryPhotoID);
                set.OwnerId = ConfigurationManager.AppSettings["defaultUser"];                
                newID = set.PhotosetId;                
                throw new Exception("You do not have CREATE permissions on the Flickr site");
            return newID;

This method works just fine from the Flickr perspective, as the new Photoset shows up just fine in Flickr, however the new Photoset does NOT show up on subsequent calls to PhotoSetsGetList(userID). (In all cases, userID is set to the default user for the account, which is stored in appsettings)

 I'm sure I am doing something stupid, but for the life of me I cannot figure out what.

 Any insight would be appreciated.





Jan 4, 2011 at 7:20 AM

It will simply be a matter of the call to PhotosetsGetList being cached. You can either disable caching using CacheDisabled, or flush the cache after the call to PhotosetsGetList using Flickr.FlushCache(Flickr.LastRequest)


Jan 4, 2011 at 10:09 PM

Thank you very much, that did the trick!