Insert JavaScript into a Content Editor Web Part (CEWP)

In the 2007 version of SharePoint, we had the Source Editor included in the Content Editor Web Part as our way of inputting JavaScript directly onto a page. The process on how to do this has changed a little bit in the new 2010 version. Follow below on how to successfully perform the same task.

Instead of having a Source Editor to directly paste in our code, we need to first create a simple text file and paste and save our code there. Once saved, upload that file to SharePoint. I am using the Site Assets library for this demo and a JavaScript that displays today’s date. After you have uploaded the file, right-click on the file and select Copy Shortcut.

Now, go to your desired page and put the page in edit mode. Add in the Content Editor Web Part located under the Media and Content category. Once added select the web part and use the ribbon UI to navigate to the Web Part Properties screen.

On the web part properties screen, paste in the URL link to your uploaded JavaScript file. Click Ok on the properties screen and, if your JavaScript is valid, it should display the desired results! Simple and easy!

Ref : Insert JavaScript into a Content Editor Web Part By sptwentyten

Custom Styles for SharePoint 2010 Rich Html Field

A typical requirement from a client is to be able to incorporate their own custom styles for the Rich Html Field. Allowing their public relations department to apply nice text formating for paragraphs with some Comic Sans Hotness might not be the best practice in here, so let’s be careful out there. The best scenario is only to allow custom formatting for headings, paragraphs and maybe a few different table styles but let’s go!

First, open up the page layout containing the HTML editor and add PrefixStyleSheet property for the RichHtmlField:

<PublishingWebControls:RichHtmlField id=”Content” FieldName=”PublishingPageContent” PrefixStyleSheet=”my-rte” runat=”server” />

Now, the default value for the property is ms-rte. We are going to redefine this to my-rte. Do not use any uppercase characters in the property value as apparently those wont work. Deploy the page and open it in edit mode to see the desired effect. The styles collections are now empty in the Ribbon.

We now have to define our own styles prefixed with the string my-rte. I’d suggest that you put these style declarations in a separate stylesheet to avoid javascript errors caused by complicated and hard-to-parse stylesheets. Let’s name our new stylesheet rte.css and add a few declarations there.

The Markup Collection

Let’s say I want to have an option to add a level 1 heading or an H1 tag for the given page via the Markup Styles dropdown list:

Step 1 – introduce the tag: { -ms-name:”my level 1 heading”; }

Step 2 – add the styles to the tag:

.my-rteElement-H1 { font-size: 150%; }

Save the rte.css and make a reference for it in your master page, page layout or even use an alernative css. If you want your clients to be able to edit the styles themself, you could upload the rte.css in the Style Library and reference it there.

I have saved the file directly in the 14-hive /_layouts/my/ -folder and use a quick reference in the master page:

<SharePoint:CssRegistration ID=”CssRegistration1″ runat=”server” Name=”/_layouts/my/rte.css” />

Deploy and reload the page, fire up the edit mode and navigate to the ribbon where you can see your new style in action.

Adding new elements is easy once you get to know the logic. Here’s an example of a parapgraph with nice rounded corners and superb font on modern browsers (note that I have combined the introduction and style values in one declaration): { -ms-name:”My CSS Rounded Paragraph”; background: #808; color: #fff; border: 3px solid #f0f; text-transform: uppercase; text-align: center; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; box-shadow: 0 0 20px #000; -moz-box-shadow: 0 0 20px #000; -webkit-box-shadow: 0 0 20px #000; padding: 10px; font: bold 2em Comic Sans MS; }

The Styles Collection

The Styles collection can be populated with the same way by changing the Element-suffix into Style ie.:

.my-rteStyle-MePinky { -ms-name:”I am pink”; color: #f0f; }

Other Items

I’d suggest that you check out the default HTML editor styles in /Style Library/en-us/Themable/Core Styles/htmleditorstyles for quick reference how to style the other elements, including table styles on the Ribbon.

Ref : Custom Style by Tuukka Uskali

SharePoint “Crawl Log error: Access Denied”

Windows Server 2003 SP1 introduced a loopback security check. This feature is obviously also present in Windows Server 2008. The feature prevents access to a web application using a fully qualified domain name (FQDN) if an attempt to access it takes place from a machine that hosts that application. The end result is a 401.1 Access Denied from the web server and a logon failure in the event log.

1. Login to the SharePoint server.
2. Click Start, click Run, type regedit, and then click OK.
3. In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa

4. Right-click Lsa, point to New, and then click DWORD Value.
5. Type DisableLoopbackCheck, and then press ENTER.
6. Right-click DisableLoopbackCheck, and then click Modify.
7. In the Value data box, type 1, and then click OK.
8. Quit Registry Editor, and then restart your computer.

However, for production environments, DO NOT DISABLE this feature. You are unpicking a serious security check of the OS. If that environment underwent a security audit by a competent security engineer, it would be flagged. You should add a list of addresses you wish to exclude. This makes your scenario work whilst retaining the security check.

1. Login to the SharePoint server.
2. Click Start, click Run, type regedit, and then click OK.
3. In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
4. Right-click MSV1_0, point to New, and then click Multi-String Value.
5. Type BackConnectionHostNames, and then press ENTER.
6. Right-click BackConnectionHostNames, and then click Modify.
7. In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
8. Quit Registry Editor, and then restart the IISAdmin service.  (Or Recycle the App-Pool).


SharePoint Search Crawler Error After Installing .NET 3.5 SP1

I installed Microsoft .NET 3.5 SP1 on SharePoint 2007 today, which was a prerequisite for an updated 3rd party application that we use with SharePoint. After the upgrade, I attempted to perform a Full Crawl but the crawl only took a few seconds and only Access Denied errors were displayed in the crawl log. After investigating the Event Viewer on the SharePoint Search server, the following error was found:

Event Type: Warning
Event Source: Office Server Search
Event Category: Gatherer
Event ID: 2436
Date:  1/27/2011
Time:  10:29:16 PM
User:  N/A
Computer: SHP1
The start address cannot be crawled.
Context: Application ‘SSP’, Catalog ‘Portal_Content’
Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has “Full Read” permissions on the SharePoint Web Application being crawled.   (0x80041205) For more information, see Help and Support Center at

After some investigation, A fix was found in KB896861 by adding theDisableLoopbackCheck key to the registry. Once the registry key was added and the IIS Admin service was restarted, I attempted to perform another full crawl and this time it was successful!

Ref :

Office 2003 and 2007 Office documents open read-only in Internet Explorer via SharePoint

After searching the web I found workaround that should work According this article:

  1. Quit all running Office 2003/07 programs.
  2. Open register (regedit.exe)
  3. Locate and then right-click the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Internet
  4. Point to New, and then click DWORD Value.
  5. Type OpenDocumentsReadWriteWhileBrowsing, and then press ENTER.
  6. Right-click OpenDocumentsReadWriteWhileBrowsing, and then click Modify.
  7. In the Value data box, type 1, and then click OK.
  8. On the File menu, click Exit to quit Registry Editor.

After testing I was able to open file in the Edit mode.

Restore My Active Desktop

1.Click Start, and then click Run.

2.In the Open box, type regedit, and then click OK.

3.Locate and then click the following registry sub-key:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Safe Mode\Components

4.In the right pane, right-click DeskHtmlVersion, and then click Modify.

5.In the Value data box, type 0 (change it from 272), and then click OK.

6.Exit Registry Editor.

7.Refresh the Desktop.

MOSS Error : The search request was unable to connect to the Search Service

I often get “The search request was unable to connect to the Search Service.” on my development/server environment.

Though Office SharePoint Server Search and Windows SharePoint Services Search windows services are running fine.


1.Restart “Office SharePoint Server Search” and “Windows SharePoint Services Search” Windows Services IISRESET (Or go for App-Pool Recycle)

This problem can also occur in new environments where these services are not configured properly

1.Go to Operations tab in Central Administration

2.Select “Services on Server” from Topology and Services

3.Select your Indexing/application Server from the server menu and make sure “Office SharePoint Server Search” and “Windows SharePoint Services Search” services are started.

Hope it helps.

My Weblog registry is a directory which stores settings and options for my Professional Life (mostly SharePoint)

%d bloggers like this: