Album

Class Album:

method addPhoto(photo, optCaption, optAutoSize)

Adds a photo to the given Album.

Arguments:

Return Values:

Type

Photo

Description

the new photo in the album

Examples:

function gmailToPicasa() {

var search = GmailApp.search('label:ToPicasa');

var email = search[0].getMessages()[0];

var photos = email.getAttachments();

var album = PicasaApp.createAlbum('New album', {

visibility: 'unlisted',

description: 'From: ' + email.getSubject()

});

for (i in photos) {

Logger.log(album.addPhoto(photos[i]).getUrl());

}

}

method deleteAlbum()

Deletes the given Album.

Examples:

var albums = PicasaApp.getAlbums();

for(i in albums){

if(albums[i].getTitle() == 'to delete'){

albums[i].deleteAlbum();

}

}

method find(query)

Returns all the photos that contain the specified query string in the Album.

Arguments:

Name

query

Type

String

Description

the search query to match

Return Values:

Type

Photo[]

Description

any photo in the album with title, caption or tag matching the search query

Examples:

var albums = PicasaApp.getAlbums();

for(i in albums){

if(albums[i].getTitle() == 'My images'){

var originalAlbum = albums[i];

}

if(albums[i].getTitle() == 'Funny ones'){

var destinationAlbum = albums[i];

}

}

var photos = originalAlbum.find('CalvinAndHobbes');

for(i in photos){

photos[i].setAlbum(destinationAlbum);

}

method getDatePublished()

Returns the Date this album was originally published.

Return Values:

Type

Date

Description

the date this album was originally published

method getDescription()

Returns the description of the Album.

Return Values:

Type

String

Description

the description of the Album

method getId()

Returns the unique id for the Album.

Return Values:

Type

String

Description

the unique id for the Album

method getLastUpdated()

Returns the Date this album was last updated.

Return Values:

Type

Date

Description

the date this album was last updated

method getLocation()

Returns the location in which the Photos of this Album have been taken.

Return Values:

Type

String

Description

the location in which the Photos of this Album have been taken

method getNumberOfPhotos()

Returns the number of Photos in the Album.

Return Values:

Type

Int

Description

the number of Photos in the Album.

method getPhotos()

Returns all the Photos in the Album.

Return Values:

Type

Photo[]

Description

the Photos in the Album.

Examples:

var photos = PicasaApp.getAlbumById('5623554255222794561').getPhotos();

for(i in photos){

Logger.log(photos[i].getTitle()+' '+photos[i].getUrl());

}

method getSize()

Returns the size of the Album.

Return Values:

Type

Int

Description

the size of the Album.

method getTitle()

Returns the title of the Album.

Return Values:

Type

String

Description

the title of the Album.

method getVisibility()

Returns the visibility level of the Album ('private', 'unlisted', 'public').

Return Values:

Description

the visibility level of the Album.

method setDescription(description)

Sets the description of the Album.

Arguments:

Name

description

Type

String

Description

the new description of the Album

Return Values:

Type

Album

Description

this Album for chaining

Examples:

PicasaApp.getAlbumById('5623554255222794561').setDescription('My trip to NYC').setLocation('NYC');

method setLocation(location)

Sets the location in which the Photos of this Album have been taken.

Arguments:

Name

location

Type

String

Description

the new location of the Album

Return Values:

Type

Album

Description

this Album for chaining

Examples:

PicasaApp.getAlbumById('5623554255222794561').setDescription('My trip to NYC').setLocation('NYC');

method setTitle(title)

Sets the title of the Album.

Arguments:

Name

title

Type

String

Description

the new title of the Album

Return Values:

Type

Album

Description

this Album for chaining

Examples:

PicasaApp.getAlbumById('5623554255222794561').setTitle('My trip to NYC').setLocation('NYC');

method setVisibility(VisibilityLevel)

Sets the visibility level of the Album.

Arguments:

Name

VisibilityLevel

Description

the new visibility level of the Album

Return Values:

Type

Album

Description

this Album for chaining

Examples:

PicasaApp.getAlbumById('5623554255222794561').setVisibility('unlisted');