FlickrNet API Library Photo.DateTaken is null

Topics: Developer Forum, Project Management Forum, User Forum
Jun 16, 2010 at 10:16 AM
Hi; i work with the FlickrNet API Library, in my web application in ASP.NET; and i use this api to retrive photos from Flickr; my problem is when i perform my request, i receive the photos; well; Now; the problem is that the DateTaken of all photos that i have received (100) in the PhotoCollection; are all null, and i got this date "01/01/0001 00:00:00" for all photos; and all the date's fields have the same valus. My code to perform the request is: string apikey = "MyKey"; Flickr flickr = new Flickr(apikey); PhotoSearchOptions searchOptions = new PhotoSearchOptions(); searchOptions.SortOrder = PhotoSearchSortOrder.DatePostedAscending; searchOptions.Tags = _keywords; PhotoCollection photos = flickr.PhotosSearch(searchOptions); foreach (Photo ph in photos) { Literal lit = new Literal(); lit.Text += ph.DateTaken + "
"; divContentFlickrDates.Controls.Add(lit); } Please some one help me. Thank you.
Coordinator
Jun 16, 2010 at 10:21 AM

DateTaken is not returned by default - you need to include that in your list of things to return by setting the PhotoSearchOptions.Extras property.

Sam

Jun 16, 2010 at 10:28 AM
Greaaaaaaaaaat; it work now; I have just a last question: is that true for all fields that are null now? Thanks a looooooooooooot!!!!!!
Coordinator
Jun 16, 2010 at 10:32 AM

If a field is null then yes, it is probably because you need to include it in the Extras. You can use PhotosSearchExtras.All to just return everything.

Some fields might also only be returned depending on permissions or for authenticated calls only.

Sam

Jun 16, 2010 at 10:40 AM
Thanks, it's ok now; i can get all data that i need for. Thanks again.
Jun 16, 2010 at 10:50 AM
Last Thing please; Do you know how i can get the location of a photo, i mean the address, not (Langitude and latitude, and placeID), i need to get a string yhing. Thank you.
Coordinator
Jun 16, 2010 at 10:56 AM

All locations in Flickr are called 'Places', so you'd need to get the PlaceId for a particular location.

If you have the lat/lon of the photo then calling Flickr.PlacesFindByLatLon should give you that information.

Jun 16, 2010 at 11:06 AM
I just try it; effectively; i have not the langitude and latitude in the majoriry of cases, than i must use the placeID, but i haven't found a method that accept only placeID, there is also one parametter "woeid", whet is this parametter, and what method i shoul use?? Thank you sam, you have help me a lot.
Jun 16, 2010 at 11:15 AM
I have use PhotosSearchExtras.All ; and the lan/lat and placeID and whoID are always null; is it normal?? Thank you.
Coordinator
Jun 16, 2010 at 11:16 AM

Well if you include PhotoSearchExtras.Geo in your search then you will get the lat/lon where that is available. You can then use that to look up the place using the above method.

If you already have a placeId then a call to Flickr.PlacesGetInfo would be the method to use. This method takes two parameters, the placeId and the woeId - you need to pass one of them but the other one can always be null.

Sam

p.s. WOE stands for "Where On Earth" and is very similar to a Flickr Place ID but is used elsewhere in Yahoo as well.

Jun 16, 2010 at 12:23 PM
thank you for your answers, but i have use PhotoSearchExtras.All, and the lat/long and placeID and woeID are always null, i have doing several request but the result doesn't change; have you try it?it works?
Coordinator
Jun 16, 2010 at 2:41 PM

Can you check what version you are using. There should be no problems if you are using the latest version. I have just uploaded 3.0 Beta 3, so give that a go if you are still having trouble.

Are you sure that the photos that are being returned have geolocation information? Perhaps you could give me an example of some of the photos you are searching for.

Another option is to set the PhotoSearchOptions.HasGeo = True so the search only returns those that do have Geo data.

Jun 16, 2010 at 2:56 PM
hi; i use the 3.0 version; i m not sure that all photos returned has Geo informations; but there is not 1/100 that have this info, so i think thre is a probleme; i have just tried the third option and now i have this exception "Unknoun attribute: geo_is_family=0"; what do you think about this. thanks
Coordinator
Jun 16, 2010 at 3:01 PM
Yes - that error is the reason for the new version - download that and
you should be fine.

Sam
Jun 16, 2010 at 3:03 PM
ok, i will try that; with the new version, i do make changes of my code or no?
Coordinator
Jun 16, 2010 at 3:07 PM
No, you shouldn't need to make any code changes.
Jun 16, 2010 at 3:21 PM
yoh, yoh, yohhhhhhhhhhhh, very well it work fine; just one precision, flickr.PlacesGetInfo(photo.PlaceId, photo.WoeId) will return a PlaceInfo object, i have used flickr.PlacesGetInfo(ph.PlaceId, ph.WoeId).Description, to get the locality; hey hey hey; yhanks a lot SAAAAAAAAAAAM.