More in this section

Forums / Developing with Sitefinity / Thumbnail url of the news item

Thumbnail url of the news item

2 posts, 0 answered
  1. Anju
    Anju avatar
    19 posts
    22 Jul 2014
    01 Jun 2015
    Link to this post

    Hi All,

    I am having a newsitem object and i need to get the url of the thumbnail image of that particular news item. Here is the code i am using:


    public string GetNewsImage(NewsItem item)
               string imageUrl = string.Empty;
               if (item != null)
                   var relatedItems = item.GetRelatedItems("Thumbnail");

                   var thumbNail = relatedItems.FirstOrDefault();
                   if (thumbNail != null)
                       LibrariesManager lb = new LibrariesManager();
                           var image = lb.GetImage(thumbNail.Id);
                           if (null != image)
                               imageUrl = image.ItemDefaultUrl;
                       catch(Exception ex)

               return imageUrl;


    But i am not getting all the images with the correct path. Some of the images are not getting the right path using this method. What am i doing wrong. PAny help or hint.


    Thanks in advance!!

    Anju Raman

  2. Kaloyan
    Kaloyan avatar
    272 posts
    06 Feb 2017
    04 Jun 2015
    Link to this post
    Hello Anju,

    Can you please tell me whether you are using related media field in the news module of your project? If this is correct you can check the following documentation article:

    Query item relations using ContentLinksManager

    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered