none
Best way to display the value of a properties field on the footer of every web page.

    Question

  • We use one master page for all of our intranet web pages.  There is a common footer built into the master page that appears on all these web pages.  Many different publishers publish these pages.  We would like to include a link in the footer that says "Contact Publisher" and that link would send an email to whatever email address is in the "Contact Email Address" Properties field for that page.

    How can I use the value of the the Contact Email Address field to build this link within the footer of every page?

    Wednesday, June 06, 2012 7:13 PM

Answers

  • One way you could do this is build a user control that gets a reference to the current page and then retrieves the contact email field and prints this out as a mailto link. This would just need to be then added to your masterpage.

    protected override void Render(HtmlTextWriter writer)
    {
         try
         {
              SPListItem page = SPContext.Current.ListItem;
    
              String email = page["Contact E-Mail Address"].ToString();
    
              if (email != null)
              {
                   HTML = "<a href='mailto:" + email + "'>Contact Publisher</a>";
              }
              writer.WriteLine(HTML);
         }
         catch (Exception e) { }
    }


    Thursday, June 07, 2012 12:52 AM

All replies

  • i know someone who just did this will refer to them.

    SharePoint 2010 MCITP & MCPD | Office 365 MCITP My Blog | My Work

    Wednesday, June 06, 2012 11:36 PM
  • One way you could do this is build a user control that gets a reference to the current page and then retrieves the contact email field and prints this out as a mailto link. This would just need to be then added to your masterpage.

    protected override void Render(HtmlTextWriter writer)
    {
         try
         {
              SPListItem page = SPContext.Current.ListItem;
    
              String email = page["Contact E-Mail Address"].ToString();
    
              if (email != null)
              {
                   HTML = "<a href='mailto:" + email + "'>Contact Publisher</a>";
              }
              writer.WriteLine(HTML);
         }
         catch (Exception e) { }
    }


    Thursday, June 07, 2012 12:52 AM
  • Hi there,
          Whey don't you just build the footer into your masterpage using sharepoint designer?
    Hope this helps

    Patrick

    Thursday, June 07, 2012 2:01 AM