Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a SPList Item with GUID of "212E3462-B24C-4F84-8CA0-3A703C492B8E". This is news item which has some images with thumbnails. I have multiple zones enabled for my site with AAM. I am trying to get the Thumbnail URLs for different zones. I am always getting only one default site domain name in the Thumbnail URL. Here is the code snippet. Please let me know what is the problem with my code.

        public NewsItem(SPListItem item)
    {
        // Get item details
        this.Title = item[SPBuiltInFieldId.Title].ToString();
        this.StartDate = (DateTime)item[new Guid(Fields.StartDateFieldId)];
        this.EndDate = (DateTime)item[new Guid(Fields.EndDateFieldId)];
        this.ContentType = item.ContentType.Name;
        this.Headline = item[new Guid(Fields.HeadlineFieldId)].ToString();
        this.NewsBody = item[new Guid(Fields.MainBody)].ToString();
        this.Location = SPHelper.GetTaxonomyFieldValue(item, new Guid(Fields.Location), ", ");
        this.CategoryList = SPHelper.GetTaxonomyFieldValuesList(item, new Guid(Fields.NewsCategory));
        this.TagList = SPHelper.GetTaxonomyFieldValuesList(item, new Guid(Fields.Tags));
        this.Type = item.ContentTypeId.ToString().StartsWith(ContentTypes.NewsBase_ID, StringComparison.CurrentCultureIgnoreCase) ? NewsType.News : NewsType.Events;
        Logger logger = CustomLogManager.GetCurrentClassLogger();
        logger.OpenLogFile();                   
        // Construct the URLs needed
        this.MoreUrl = string.Format("{0}{1}?lstId={2}&itmId={3}&m={4}&y={5}&ct={6}",
                                //item.ParentList.ParentWeb.Url,
                                item.ParentList.ParentWeb.ServerRelativeUrl,                                                                       
                                ((Type == NewsType.News) ? PageConstants.NewsDetailPage_Url : PageConstants.EventDetailPage_Url),
                                item.ParentList.ID,
                                item.ID,
                                StartDate.Month,
                                StartDate.Year,
                                ContentType);            
        this.ArchiveBrowserUrl = string.Format("{0}{1}?m={2}&y={3}&ct={4}",                                    
                                item.ParentList.ParentWeb.ServerRelativeUrl, 
                                ((Type == NewsType.News) ? PageConstants.NewsTimelinePage_Url : PageConstants.EventsTimelinePage_Url),
                                StartDate.Month,
                                StartDate.Year,
                                ContentType);                      
        // Get the image - if missing get 'no image'
        if (item[new Guid(Fields.ThumbnailFieldId)] != null)
        {
            SPFieldUrlValue thumbnail = new SPFieldUrlValue(item[new Guid(Fields.ThumbnailFieldId)].ToString());
            this.ThumbnailUrl = thumbnail.Url;
            logger.Info("Guid - " + Fields.ThumbnailFieldId);
            logger.Info(" this.ThumbnailUrl - " + this.ThumbnailUrl);
        }
        else
        {
            this.ThumbnailUrl = SPUtility.ConcatUrls(item.ParentList.ParentWeb.ServerRelativeUrl, CommonConstants.Default_Img_Url);                
        }                      
    }
share|improve this question
    
Could some one help me wiht this please? –  Ram Apr 3 '13 at 8:53

1 Answer 1

Take a look here: http://moriokumagawa.blogspot.nl/2013/02/alternate-access-mappings-and.html

SPFieldUrlValue from codebehind results in URL's in default zone.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.