PhotosetsGetPhotos not returning DateTaken or DateUploaded

Topics: Developer Forum
Jul 21, 2014 at 1:02 AM
PhotosetsGetPhotos(string photosetId, int page, int perPage) does not return the photo's DateTaken or DateUploaded. The value returned is always {0001-01-01 12:00:00 AM}.

The match by date taken functionality in the app FlickrSync (https://flickrsync.codeplex.com/) no longer works.
Coordinator
Jul 21, 2014 at 9:16 AM
Are you asking for the date taken and date uploaded in the PhotoSearchExtras parameter?
var photoset = flickr.PhotosetsGetPhotos(setId, PhotoSearchExtras.DateTaken | PhotoSearchExtras.DateUploaded);
Sam
Jul 21, 2014 at 11:51 PM
No, the code block actually uses PhotosetsGetPhotos(string photosetId, int page, int perPage). I jumped into helping support FlickrSync 3 weeks ago and despite 26 years IT experience (enterprise systems - SAP), I am a total newbie to .net development, the flickr API, and FlickrNet. Pedro Geada's FlickrSync has an option to match local pictures to uploaded pictures by date taken, but this isn't working. I raised the FlickrNet issue because debugging revealed that the DateTaken wasn't being returned. I am includung the code block used to retrieve photo info from Flickr. Most of the code in FlickrSync dates back to 2009, so I expect there are better ways using FlickrNet. Should I be using PhotoSearchExtras variant?
public class RemoteInfo
{
    Flickr f; .....

    public Photo[] SetPhotos(string SetId)
    {
        List <Photo> PhotoList = new List<Photo>();         
        int nPage = 1;
        PhotosetPhotoCollection zPhotoPage;
        do {
            zPhotoPage = f.PhotosetsGetPhotos(SetId,nPage, 500);
            for (int i=0; i<zPhotoPage.Count; i++)
                PhotoList.Add(zPhotoPage[i]);
            nPage++;
        } while (zPhotoPage.Count==500);
        return PhotoList.ToArray();
    }
Jul 22, 2014 at 7:32 AM
PhotosetsGetPhotos(setId, PhotoSearchExtras.DateTaken | PhotoSearchExtras.DateUploaded) achieves the result required. Thanks!!!
Coordinator
Jul 22, 2014 at 8:34 AM
Yes. You can pass the page and perPage parameters in as well.
zPhotoPage = f.PhotosetsGetPhotos(SetId,PhotoSearchExtras.DateTaken | PhotoSearchExtras.DateUploaded, nPage, 500)
Also note, it would be much simpler to do
PhotoList.AddRange(zPhotoPage)
The PhotosetPhotoCollection is an IEnumerable<Photo> to can be passed straight to the AddRange method of your list.

Sam
Jul 27, 2014 at 5:59 AM
Thanks Sam,
Your suggestions work beautifully.