More in this section
Forums / Sitefinity SDK / Dynamically Create Image Album

Dynamically Create Image Album

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Scott
    Scott avatar
    7 posts
    02 Jan 2011
    29 Mar 2011
    Link to this post
    I've been trying to dynamically create a image album and I've used the following sample code from the API documentaiton.  The problem is that this code returns an empty GUID and the Album doesn't appear in SiteFinity.  Is this a bug or am I missing something obvious?

    (I'm using SiteFinity 4.0 SP1)

    public static Guid CreateAlbum(string title, string urlName, string description)
        Guid newAlbumId = Guid.Empty;
            .Do(a =>
                    a.Title = title;
                    a.Description = description;
                    a.UrlName = urlName;
                    newAlbumId = a.Id;
        return newAlbumId;

    Thanks for your assistance.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    04 Apr 2011
    Link to this post
    Hi Scott,

    Try using this code

    private Album CreateAlbum(urlName)
         var manager = LibrariesManager.GetManager();   
         var album = manager.GetAlbums().ToList().Where(a => a.UrlName == "somename").FirstOrDefault();
         if (album == null)
                 a =>
                     a.Title = "Album for blog " + blog.Title;
                     a.Description = "my description";
                    var id = a.Id;
             ).Get(out album).SaveChanges();
         return album;

    I am not able to replicate the issue you reported. The Id is returned by the Content object

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered