Search code examples
c#asp.netgdatapicasa

Error: "Photo data or source id must be included" when I try to Upload a photo to PicasaWeb in Gdata .NET


Somebody know what I'm doing wrong?

var service = new Service("lh2", "exampleCo-exampleApp-1");
service.setUserCredentials("myuser", "mypass");

var myPhoto = new PhotoEntry
              {
                  Title = new AtomTextConstruct(
                  AtomTextConstructElementType.Title,
                  "Puppies FTW")
              };

var myMedia = new MediaFileSource(@"C:\puppies.jpg", "image/jpeg");
myPhoto.MediaSource = myMedia;

var u="https://picasaweb.google.com/data/feed/api/user/default/albumid/default";

var returnedPhoto = service.Insert(new Uri(u), myPhoto);

Actually is returning bad request error (400) with the following response string: Photo data or source id must be included


Solution

  • It was returning error because the Uri was wrong:

    I must use:

    var u="https://picasaweb.google.com/data/media/api/user/default/albumid/default";
    

    instead:

    var u="https://picasaweb.google.com/data/feed/api/user/default/albumid/default";