Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

Using the SharePoint Content Editor Web Part for Centralized Content


By:   |   Read Comments   |   Related Tips: > Sharepoint

"SQL Server in The Cloud" - click to register for this free webcast


Problem

I would like to be able to centralize a message and be able to roll it out to multiple SharePoint sites simultaneously. When the message changes, I only want to edit one section and have the changes roll out everywhere automatically.

Solution

Using the Content Editor Web Part, we can use a special feature called the "Text Link". This allows us to link to any text file in an accessible location. Thinking about this as a front-end/back-end architecture, the "back end" source data will live in a text file. The "front end" will be one or more SharePoint "Content Editor Web Parts" on a (home) page of any number of SharePoint sites. When the source text is updated, all of the linked Content Editor Web Parts will display the new text automatically and seamlessly.

Let's see how this works.

(Note: This example uses SharePoint 2010, but the same concepts apply to MOSS2007, WSS3 and WSS2.)

First we need a place to store the text file. Before proceeding, create a new document library or use an existing one. While not required, this should probably be in the root site of your site collection;

The "Text Link" can use any text format (i.e. .txt, .html, even .aspx). For this example, we will use an HTML file. The html can be created with any editor. In this case we will use SharePoint Designer. (This is a free download from Microsoft.)

With SharePoint Designer installed, click on "Site Actions", then "Edit in SharePoint Designer". (SP 2010 only, for MOSS2007/WSS3/WSS2 you will need to open SharePoint Designer separately or use another editor.)

site actions

Under "Site Objects", click "All Files". Then click on the desired document library. (I am using one called "sitedocs" that I created.)

all files

Once the library is opened, RIGHT-click into the white space under "Forms", then select "New" and then "HTML".

new html

Give your html file a meaningful name.

central message html

Once named, click the file. This will open a general properties menu page. Click on "Edit File".

central message

Type your message and save the file.

preview in browser

Back in the library, RIGHT-click on the file in the library and select "Copy Shortcut". Paste the URL temporarily into a text editor (i.e. Notepad.exe).

copy shortcut

Back on the home page of the site, click the "Page" tab and then "Edit Page".

page

Click "Add a Web Part".

add a web part

Under "Categories" choose "Media and Content", then under "Web Parts" select˙ "Content Editor". Then click the "Add" button.

media and content

From the web part menu (down pointing black triangle), select "Edit Web Part".

edit web part

In the field that says "To link to a text file, type a URL", paste the URL of your Content Message. If you prefer, you can click the elipsis (3 dots on the right) see paste or review the entire URL. Once the URL is entered, click "OK".

content editor

Click the "Stop Editing" button.

stop editing

Review the message you created in the HTML file. This is now on the home page of the site.

sharepoint 2010

You can now repeat the process of pasting the URL into any number of Content Editor Web Parts on different sites.

When you edit the source (HTML) file, all sites with the Content Editor Web Part text link will automatically update the content of the message!

Next Steps


Last Update:


next webcast button


next tip button



About the author
MSSQLTips author Rob Fisch Rob Fisch has worked with SQL Server since version 6.5 as a dba, developer, report writer and data warehouse designer.

View all my tips





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Learn more about SQL Server tools