Can't apply album template

Jun 1, 2012 at 5:53 PM

I can't figure out how to apply an album template. Here's my pseudocode; I don't get any exceptions, but the template (which does exist) is not applied. I'd appreciate any pointers.


var MyUser _user; var _templates = _user.GetAlbumTemplates() var _template = _templates.First(t => t.AlbumTemplateName == "foo"); var Album _album; _album.AlbumTemplate = _template; _album.ChangeSettings();

 

Jun 2, 2012 at 12:36 PM
Edited Jun 2, 2012 at 12:44 PM

SmugMug is expecting an AlbumTemplateID, not an AlbumTemplate object. I added the following to Album.ChangeSettings() in order to pass this value:

if (this.AlbumTemplate != null)
{
    ls.Add("AlbumTemplateID"); ls.Add(this.AlbumTemplate.id.ToString());
}

Should probably also change

var ls = BuildPropertiesValueList(this, "HasComments", "CommentsList", "Comments","Watermark");

to

var ls = BuildPropertiesValueList(this, "HasComments", "CommentsList", "Comments","Watermark","AlbumTemplate");

since there's no reason to pass the AlbumTemplate object.