当我尝试使用PhotosLibraryService API列出相册时,我总是返回null,有人可以使用新的Google Photos API吗? picasa API不再起作用。
public void ListAlbums()
{
var json = File.ReadAllText(_diretorio + "/PhotoClient/" + "client.json");
var cr = JsonConvert.DeserializeObject<PersonalServiceAccountCred>(json);
var xCred = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(cr.client_email)
{
Scopes = this._scopes
}.FromPrivateKey(cr.private_key));
// Create the service.
var service = new PhotosLibraryService(new Google.Apis.Services.BaseClientService.Initializer()
{
HttpClientInitializer = xCred
});
var albums = service.Albums.List().Execute();
}
谢谢!