Access to my private photos

Topics: User Forum
Feb 24, 2007 at 10:09 AM
Hi,
the method PeopleGetPublicPhotos allows to get public photos of any Flickr user. How can I get my private photos with Flickrnet?
Thanks
Coordinator
Mar 4, 2007 at 3:41 PM
Edited Mar 4, 2007 at 3:41 PM
Use the PhotosSearch method and specify the UserId property of the PhotosSearchOptions parameter.

You'll also need to be authenticated as well obviously.
Mar 7, 2008 at 2:26 AM
I'm using this code to get photos but I still just get public photos. Help would be appreciated.

First I sign in using this:

Flickr flickr = new Flickr(ApiKey, SharedSecret);
string url = flickr.AuthCalcWebUrl(AuthLevel.Read);


And then I get the photos using this:

PhotoSearchOptions options = new FlickrNet.PhotoSearchOptions();
options.UserId = auth.User.UserId;
options.PerPage = perPage;
options.Page = page;
options.SortOrder = FlickrNet.PhotoSearchSortOrder.DatePostedDesc;
options.PrivacyFilter = FlickrNet.PrivacyFilter.CompletelyPrivate;
FlickrNet.Photos photos = flickr.PhotosSearch(options);
Coordinator
Mar 7, 2008 at 9:14 AM
Are you redirecting the user to the URL you've generated? If you've not actually been to the FLickr web site then you've not 'signed in'. You need to get the authentication token which you get when you do this.

Please see the example applications for working examples of winforms and web based authentication with Flickr.
Mar 10, 2008 at 2:47 AM
Yeah, I do that. So this is how I do it (it's a web based application):

On the first page I've got a button, when you push it you go to the Flickr web site and log in.

protected void Page_Load(object sender, EventArgs e)
{
Flickr flickr = new Flickr(ApiKey, SharedSecret);
string url = flickr.AuthCalcWebUrl(AuthLevel.Read);
}

protected void Button1_Click(object sender, EventArgs e)
{
Flickr flickr = new Flickr(ApiKey, SharedSecret);
string url = flickr.AuthCalcWebUrl(AuthLevel.Read);
Response.Redirect(url);
}


After you've logged in you get redirected back to my site where I get the frob, authentication token and try to get all the users photos and display them. No private photos are displayed.

protected void Page_Load(object sender, EventArgs e)
{
string frob = Request.QueryString"frob";
flickr = new Flickr(ApiKey, SharedSecret);
Auth auth = flickr.AuthGetToken(frob);

PhotoSearchOptions options = new FlickrNet.PhotoSearchOptions();
options.UserId = auth.User.UserId;
options.PerPage = perPage;
options.Page = page;
options.SortOrder = FlickrNet.PhotoSearchSortOrder.DatePostedDesc;
options.PrivacyFilter = FlickrNet.PrivacyFilter.CompletelyPrivate;

FlickrNet.Photos photos = flickr.PhotosSearch(options);

PhotoRepeater.DataSource = photos.PhotoCollection;
PhotoRepeater.DataBind();
}

So to the problem remain. No private photos are displayed eventhough I specify CompletelyPrivate on the search. I've simplified the code a bit.
Coordinator
Mar 10, 2008 at 11:48 AM
Currently, calling AuthGetToken does not set the auth token on the Flickr instance, so you need to add the following line:

flickr.AuthToken = auth.Token;
Mar 11, 2008 at 2:36 AM
Thanks, that was the thing that I needed to make it work!