This project has moved and is read-only. For the latest updates, please go here.

Why the value of retrieved tags are null?

Topics: Developer Forum, Project Management Forum, User Forum
Sep 6, 2010 at 11:38 AM

I've created a List<Photo> named photos from the PhotoCollection retrieved by Flickr.PhotosSearch().I'm troubled in output photos' tags.Anyone help me ?Thanks.

PhotoCollection photoCollection = flickr.PhotosSearch(searchOptions);            

List<Photo> photos = new List<Photo>();            


foreach (Photo photo in photos)        


//how to output the tags into the screen?



Sep 6, 2010 at 12:01 PM

PhotoCollection IS a list of photos - so there is no need to create a separate list:

The Tags property is a collection of strings, so you can just iterate over it as well.

PhotoCollection photoCollection = flickr.PhotosSearch(searchOptions);            

foreach (Photo photo in photoCollection)        

    foreach(string tag in photo.Tags)

Sep 6, 2010 at 12:58 PM


However,the value of photo's tag is null after retrieving process.(And some other properties are the photo.views.)My code are as followed,

PhotoSearchOptions searchOptions = new PhotoSearchOptions();          

searchOptions.UserId = "35750010@N02";      

searchOptions.SortOrder = PhotoSearchSortOrder.DatePostedDescending;            

 PhotoCollection photoCollection = flickr.PhotosSearch(searchOptions);                  

 foreach (Photo photo in photoCollection)          

 {                String photoID = photo.PhotoId;                

Console.WriteLine("The photo id is: {0}", photoID);//it works.

 Int32 viewCount = photo.Views.Value;//the value of Views is null when debugging              

                foreach (string tag in photo.Tags)                  

  Console.WriteLine("The tags are: {0}",tag);//the count of Tags is 0


Sep 6, 2010 at 1:08 PM

Yes, tags and other metadata are not returned unless you specifically ask for them.

searchOptions.PhotoExtras |= PhotoSearchExtras.Tags | PhotoSearchExtras.Views;


Sep 6, 2010 at 1:40 PM

Great.It works now.

Btw,it there any document online?


Sep 6, 2010 at 3:19 PM
I've readded the 3.0 release documentation to the downloads page. This
doesn't cover the new async functionality but it covers almost all of
the rest.

It is probably more useful thought to read the Flickr API docs and
learn how they work - the Flickr.Net library simply mirrors what they