How We Can Create Search Provider in Internet Explorer 8 Beta

Search Provider

New to Internet Explorer 8 is the concept of Accelerators. Accelerators enable you to access service providers anywhere on the page

Search Provider Categories

– Web Search
– Topic search

The following sample OpenSearch Description file contains the search provider’s name, URL, and icon.

 <?xml version=”1.0″ encoding=”UTF-8″?>
<OpenSearchDescription xmlns=”http://a9.com/-/spec/opensearch/1.1/“>
 <ShortName>My Custom Search</ShortName>
 <Url type=”text/html” template=”http://example.com/?q={searchTerms}&amp;source=IE”/>   
 <Image height=”16″ width=”16″ type=”image/icon”>http://example.com/mycustom.ico</Image>
</OpenSearchDescription>

All OpenSearch Description files must include the search provider name and search URL. Without these elements, Internet Explorer 8 cannot install your search provider. All search URLs must contain “q={searchTerms}” somewhere in the query string. When Internet Explorer 8 navigates to this provider to get search results, “{searchTerms}” is replaced by the query string that the user typed into the Instant Search box. you should include an icon within the OpenSearch Description file.

Solving ActiveX Problem in SharePoint

Did you get the following message will be a turn-on when loading public Sharepoint sites,

The Web site wants to run the following add-on: ‘Name ActiveX Control’ from ‘Microsoft Corporation’. If you trust the Web site and the add-on and want to allow it to run, click here…

To fix this problem, just create a js file and paste the following codes to that file,

function ProcessDefaultOnLoad(onLoadFunctionNames)
{
ProcessPNGImages();
UpdateAccessibilityUI();
for (var i=0; i < onLoadFunctionNames.length; i++)
{
var expr=”if(typeof(“+onLoadFunctionNames[i]+”)==’function’){“+onLoadFunctionNames[i]+”();}”;
eval(expr);
}
if (typeof(_spUseDefaultFocus)!=”undefined”)
DefaultFocus();
}

And then upload the javascript file to SharePoint site. After the above process, then refer the javascript file link to SharePoint master page.
Now you didn’t get any ActiveX Control problem. For more information Email us.

Shantha Kumar T MCTS )
[email protected]

Alert Notification Tips

Are you getting the e-mail alerts, Body links refers to local machine URL http://machine instead of?

This is because; there are many zones for a particular Web Application. We can see that using Alternate Access Mappings in Central administration.

Central Administration > Operations > Alternate Access Mappings (under Global Configuration )

shanblog2

The SharePoint takes the Default zone link in Alternate Access Mappings for all links when creating alerts.
To overcome this issue, add the required URL in default zone textbox in Alternate Access mappings and change the URL already in Default zone to different zone.

shanblog1

Shantha Kumar T MCTS )
[email protected]

Custom Master Page Error

If you are applying custom Master page using the custom feature, you may get the following error when viewing or creating a new site,

Cannot convert type ‘Microsoft.SharePoint.WebControls.ScriptLink’ to ‘System.Web.UI.IAttributeAccessor’

This is because; you are exporting the master page using SharePoint Designer. The master page adds the additional codes; you will be seeing that by open via notepad.

<SharePoint:CssLink runat=”server” __designer:Preview=”&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot;/&gt;
” __designer:Values=”&lt;P N=’InDesign’ T=’False’ /&gt;&lt;P N=’ID’ T=’ctl01′ /&gt;&lt;P N=’Page’ ID=’1′ /&gt;&lt;P N=’TemplateControl’ ID=’2′ /&gt;&lt;P N=’AppRelativeTemplateSourceDirectory’ R=’-1′ /&gt;”/>

<SharePoint:Theme runat=”server” __designer:Preview=”” __designer:Values=”&lt;P N=’Name’ R=’-1′ /&gt;&lt;P N=’InDesign’ T=’False’ /&gt;&lt;P N=’ID’ T=’ctl02′ /&gt;&lt;P N=’Page’ ID=’1′ /&gt;&lt;P N=’TemplateControl’ ID=’2′ /&gt;&lt;P N=’AppRelativeTemplateSourceDirectory’ R=’-1′ /&gt;”/>

<SharePoint:ScriptLink language=”javascript” name=”core.js” runat=”server” __designer:Preview=”&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;/_layouts/1033/init.js?rev=ck%2BHdHQ8ABQHif7kr%2Bj7iQ%3D%3D&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;/_layouts/1033/core.js?rev=2zFnRPcm89TszX6NUNqMTw%3D%3D&quot;&gt;&lt;/script&gt;
” __designer:Values=”&lt;P N=’Language’ T=’javascript’ /&gt;&lt;P N=’Name’ T=’core.js’ /&gt;&lt;P N=’InDesign’ T=’False’ /&gt;&lt;P N=’ID’ T=’ctl03′ /&gt;&lt;P N=’Page’ ID=’1′ /&gt;&lt;P N=’TemplateControl’ ID=’2′ /&gt;&lt;P N=’AppRelativeTemplateSourceDirectory’ R=’-1′ /&gt;”/>

<SharePoint:CustomJSUrl runat=”server” __designer:Preview=”” __designer:Values=”&lt;P N=’InDesign’ T=’False’ /&gt;&lt;P N=’ID’ T=’ctl04′ /&gt;&lt;P N=’Page’ ID=’1′ /&gt;&lt;P N=’TemplateControl’ ID=’2′ /&gt;&lt;P N=’AppRelativeTemplateSourceDirectory’ R=’-1′ /&gt;”/>

<SharePoint:SoapDiscoveryLink runat=”server” __designer:Preview=”&lt;link type=&quot;text/xml&quot; rel=&quot;alternate&quot; href=&quot;/_vti_bin/spdisco.aspx&quot; /&gt;” __designer:Values=”&lt;P N=’InDesign’ T=’False’ /&gt;&lt;P N=’ID’ T=’ctl05′ /&gt;&lt;P N=’Page’ ID=’1′ /&gt;&lt;P N=’TemplateControl’ ID=’2′ /&gt;&lt;P N=’AppRelativeTemplateSourceDirectory’ R=’-1′ /&gt;”/>

Following are actual codes for the above lines, when you are open the master page via SPD,

<SharePoint:CssLink runat=”server”/>
<SharePoint:Theme runat=”server”/>
<SharePoint:ScriptLink language=”javascript” name=”core.js” runat=”server”/>
<SharePoint:CustomJSUrl runat=”server”/>
<SharePoint:SoapDiscoveryLink runat=”server”/>

To fix this issue, don’t export the master page file using SPD. Instead just copy the code from SPD to an empty master file.

Shantha Kumar T (MCTS)
[email protected]

Live Cricket Scores in SharePoint Site

Cricinfo.com site provides RSS feeds of live cricket scores. This can be accessed from the URL http://www.cricinfo.com/rss/livescores.xml. Using this feed and Sharepoint designer live cricket scores can be displayed in Sharepoint sites within a jiffy. For using the RSS feed we will have to create a data source. Following are the steps to create a data sources to the live scores RSS feed

1. Fire up Sharepoint designer.
2. Open the page in which you want to place the cricket scores.
3. Open the Data Source Library pane by selecting Data Source Library menu under Task Panes menu.
4. Expand the Server-side Scripts section.
5. Click on Connect to a script or RSS Feed link.
6. Paste the URL http://www.cricinfo.com/rss/livescores.xml in the Enter URL to a server-side script text box.
7. Click the OK button.

Once a data source is created, it can be bound to a data view web part as explained in below steps

1. Drag and drop the new RSS Feed data source into the page.
2. Click the Common Data View Tasks arrow button and select Edit Columns.
3. Remove all columns except the title.
4. In the page select one of the values of the title field.
5. Click on Common xsl:value-of Tasks arrow button.
6. For the Format as the dropdown, change it from Text to Hyperlink.
7. Click Yes to the confirmation dialog.
8. In the Edit Hyperlink dialog box enter {link} in Address field and {title} in Text to display field
9. Click the OK button.
10. Change the heading from title to Cricinfo live scores

Cheers 

Add Flash File to SharePoint Rich Text Field Editor

SharePoint Rich-Text filed editor allows us to write the HTML code, but it doesn’t allow us to embed Flash files.

So, I have searched on this issue and come with a solution.  For that, I’m using swfobject.js file and adding some script lines to the page where we want to embed this flash file. Following are the procedures used to embed Flash file into SharePoint

Step 1: Upload the swfobject.js file to SharePoint library

Step 2: Include the JavaScript file to the SharePoint page,

<script type=”text/javascript” src=”swfobject.js”></script>

Step 3: Add the following javascript lines at the end of the page, before the end of the <asp:content>,
<script type=”text/javascript”>
function EmbedFlash()
{
    //Get the div tag from the file
    var divLayer = document.getElementsByTagName(‘div’);
    //Check the div tag’s classname equal to flashcontent
    if (divLayer.length>0)
    {
        var myFlash = new Array()
        for (i=0; i<divLayer.length; i++)
        {        
            if (divLayer[i].className == ‘flashcontent’)
            {
                myFlash.push(divLayer[i].id)
            }
        }
        var so = new Array()
        for (j=0; j<myFlash.length; j++)
        {
        //split the div tag based on ::
            tempParam = myFlash[j].split(‘::’)
        //Following method used to display the flash file, swfobject.embedSWF([URL],[div Id],[Height], [Width], [Flash Version], [Background Colour], [Alternative flash or image]);
            swfobject.embedSWF(tempParam[0], tempParam[1], tempParam[2], tempParam[3], tempParam[4], tempParam[5],”expressInstall.swf”);
        }
    }
}
EmbedFlash()
</script>

EmbedFlash method gets all the div elements in current page and filters those elements based on classname=’flashcontent’. If div’s calssname is flashcontent, then it split the id of the div tag based on ::  and it call the embedSWF method from swfobject.js to embed the flash file.

Step 4: This is the main step, including the tags to sharepoint Rich-Text Field editor. Add Two div tags in editor as follows,
<div id=”video1″ />

<div class=”flashcontent” id=”flash_video.swf::video1::425::355::9::#FFFFFF”></div>

 

First div tag used to display the image and other div tag used to give the information to javascript about the flash file.
Div tag is in format as follows,

 id=”[Flash URL]::[div id]::[Height]::[Width]::[FlashVersion]::[Background Colour]

Step 5: After publishing the page, it dispalys the flash conetnt.
Shantha Kumar .T

Custom Document Property as Page Title

When a new webpart page is added to a SharePoint document library the title of the page appears as Library Name – Page Name. For instance, if the document library name is WebPages and the page name is Page1 the title would appear as WebPages – Page1. This is the title that would be displayed on the title bar of the browser, but more importantly, this will be the text displayed by search engines.

In order to give a more meaningful title for the webpart pages we will have to open the page in SharePoint designer and replace the content of ContentPlaceHolder with the id PlaceHolderPageTitle. Below is the default content of PlaceHolderPageTitle

<asp:Content ContentPlaceHolderId=”PlaceHolderPageTitle” runat=”server”>

                <SharePoint:ListProperty Property=”Title” runat=”server”/> –

                <SharePoint:ListItemProperty Property=”BaseName” MaxLength=40 runat=”server”/>

</asp:Content>

You can give a meaningful title by replacing the content as something below

<asp:Content ContentPlaceHolderId=”PlaceHolderPageTitle” runat=”server”>

                MyWebsite ::: A meaningful title

</asp:Content>

A more neat approach would be to add a custom field to the document library and use that field information for the title. For instance, if we a add text field by the name of WebPageTitle to the document library we can use it as the title as shown below

<asp:Content ContentPlaceHolderId=”PlaceHolderPageTitle” runat=”server”>

<SharePoint:ListItemProperty Property=”WebPageTitle” MaxLength=40 runat=”server”/>

</asp:Content>

Cheers JJ