We have AAM configured and we have some web parts. One of the web part is visible in extranet web site. The same web part is not visible when we access from the same network. I have checked the properties of the web part to see if it is hidden within our network. But it is not hidden. What would be the reason for the invisiblity of the web part within the network. Could you some one help me with this please?

The following is the code.

  private void LoadCEOMEssageDetails()
        // Get CEO message new item
        NewsItem message = null;
        NewsHelper helper = new NewsHelper();
        using (SPSite site = new SPSite(NewsSiteUrl))           
            using (SPWeb web = site.OpenWeb())
                SPList list = web.Lists.TryGetList(NewsListTitle);
                if (list != null)
                    message = helper.GetCEOMessage(list);

        if (message == null)
            (this.Parent as WebPart).Hidden = true;

        // Set the 'new' icon
        if (message.IsNewItem)
            imgNewMsg.Visible = true;
            imgNewMsg.ImageUrl = "/_layouts/1033/images/new.gif";

        // Display the details
        lblCeoMessageTitle.Text = message.Title;
        lblCeoMessageTitle.NavigateUrl = message.MoreUrl;
        lblMessageDate.Text = message.StartDateString;
        lblCeoMessage.Text = message.Headline;
        imgCeoImageUrl.ImageUrl = message.ThumbnailUrl;
        hlReadMore.NavigateUrl = message.MoreUrl;
        //hlViewMore.NavigateUrl = string.Format("{0}{1}{2}?ct={3}", SPContext.Current.Web.Url, WebConstants.NewsSiteUrl, PageConstants.NewsTimelinePage_Url, message.ContentType);
        hlViewMore.NavigateUrl = string.Format("{0}{1}?ct={2}", NewsSiteUrl, PageConstants.NewsTimelinePage_Url, message.ContentType);
public NewsItem GetCEOMessage(SPList list)
        NewsItem message = null;
        // DateTime.Now in SP format
        string dateString = SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now);

        // Get 1 item from the current CEO Message items
        SPQuery query = new SPQuery();
        query.RowLimit = 1;
        query.Query = string.Format(NewsQueryConstants.ItemsTimespan_ByCategory_ToBeDispayed, dateString, ContentTypes.CEOMessage_Name);

        SPListItemCollection result = list.GetItems(query);
        if (result.Count > 0)
            SPListItem item = result[0];
            message = new NewsItem(item);
        return message;

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;                     
        // Construct the URLs needed
        this.MoreUrl = string.Format("{0}{1}?lstId={2}&itmId={3}&m={4}&y={5}&ct={6}",
                                ((Type == NewsType.News) ? PageConstants.NewsDetailPage_Url : PageConstants.EventDetailPage_Url),
        this.ArchiveBrowserUrl = string.Format("{0}{1}?m={2}&y={3}&ct={4}",                                    
                                ((Type == NewsType.News) ? PageConstants.NewsTimelinePage_Url : PageConstants.EventsTimelinePage_Url),
        // 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());
            string tempURL = thumbnail.Url.Replace("http://intranet.swlstg-test.nhs.uk", SPContext.Current.Site.Url.ToString());                    
            this.ThumbnailUrl = tempURL.ToString();                
            this.ThumbnailUrl = SPUtility.ConcatUrls(item.ParentList.ParentWeb.ServerRelativeUrl, CommonConstants.Default_Img_Url);                
  • Tell us more about this mystery web part: Is it a built-in or custom one? What is its purpose? Is it entirely missing from the source code of the page? – Stu Pegg Apr 15 '13 at 9:05
  • Thanks Stuart. I am able to see the web part displaying on the home page with no results. I have added the code in the original post. Could you please help me with this? – Ram Apr 15 '13 at 10:15

Looking at your code it seems the most likely explanation is that the message variable is null.

Here are a few possible reasons for this:

  • You're accessing the web part internally via a different site, which doesn't contain the 'News' list
  • The users accessing the site internally don't have permissions to the 'News' list (touched-on by Ali)
  • You have item-level permissions on the list, and none of the items are accessible to internal users


  • An error is occurring in your code (possibly related to the URL being different) and the web part is failing. Your ULS log would contain an error for each page view if this were true.
| improve this answer | |
  • Guys, I have figured this out. It was the Chrome Type of my web part which is not showing the results. Now, I have fixed this. Many thanks Stuart. – Ram Apr 15 '13 at 12:55

there could be many reasons why the webpart is not showing! down to the use! have you tried with other accounts and what is the result? try using an admin account vs normal and see the difference on both extranet vs intranet

have you tried ?contents=1 at the end of the url to see a list of all the webparts on the page, find the culprit webpart and see if the checkbox for hidden is selected? do it on both intranet and extranet to see any differences.

now you need to know is it a custom webpart or OOTB webpart? also if its being hidden or actually closed?

Closed vs. Hidden Web Part - what is the difference?

| improve this answer | |
  • Hi Ali,It is a custom web part I have added the code to the original post. Could you please help me with this? – Ram Apr 15 '13 at 10:16
  • ok from your comment, it looks like the webpart is displayed but not returning the results~? its basicly an empty webpart, ok so your running a query against a list? and it works when your logged in to extranet but not intranet? when looking at your error log what do you see? any errors? – Ali Jafer Apr 15 '13 at 11:36
  • have you tried with a domain account or admin account? or does it happen to all accounts regardless? – Ali Jafer Apr 15 '13 at 11:36
  • Guys, I have figured this out. It was the Chrome Type of my web part which is not showing the results. Now, I have fixed this. Many thanks for all. – Ram Apr 15 '13 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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