Saturday, May 2, 2009

Microsoft Office 14 for Web

Microsoft announced their new component in the Office system ‘The Office Web Applications’ at the PDC 2008. These would be available as a part the next version of Office which would be Office 14. The Office 14 for web is a group of light weight, cross platform, cross browser versions of applications like Word, Excel, PowerPoint, One Note etc.

Office Web Applications are all about giving people access to their familiar Office applications even when they are away from their desktop. So this does mean that in the next release what you would need to make a proposal document is just a browser.

Check this cool video where Antoine Leblond from the Office group introduces to some of the features of Office 14 for Web.

 

Friday, May 1, 2009

Making your SharePoint environment ready for Silverlight development

SharePoint and Silverlight can be integrated together to provide an interactive user experience. The data within SharePoint and various LOBs can be delivered to the end user in a compelling manner using Silverlight.

But making SharePoint Server 2007 environment ready for Silverlight development is a bit challenging and a time consuming process. There are several updates and components needed on the development machine before you can actually begin Silverlight development. For instance, to see a Silverlight application in action on a SharePoint Web page proper configurations need to be made in the web.config of the Web application.

To address the same challenges,
Advaiya has developed a tool Advaiya Development Scanner which analyzes a target machine for the necessary components, and reports what is already installed and what needs to be installed or updated in order to support Silverlight 2.0 development. Along with this it also makes the necessary web config modifications on the targeted Web applications.

The demo of the tool can be seen
here in action.

OOB publishing image field with hyperlink bug: Resolved

Couple of times SharePoint presents an odd behavior. I came across one of such behaviors recently where the publishing image field was getting rendered incorrectly when seen in the display mode. Instead of showing the image the publishing field shows the IMG tags.

Searching around the internet I found other people reporting the same issue followed by a workaround given by Stefan Gossner on his blog.

The workaround he suggested includes creating a custom field control which inherits from the RichImageField class.

After implementing the same I was able to get rid of this issue, but soon i discovered one more bug :-( . It was if you assign a hyperlink (e.g. http://www.microsoft.com) to an image, then the publishing image field also renders the hyperlink along with the image.

This occurs specifically in case when the hyperlinks include the protocol with them (http or https etc.).

After inspecting this issue I found that it was all due to the malformed anchor tag.

A well formed HTML output should be:

<span dir=""><a href="http://www.microsoft.com"><img alt="" border="0" src="/PublishingImages/ add.gif" style="BORDER: 0px solid; "></a></span>

But with the issue it was:

<span dir=""><a href="<a href="http://www.microsoft.com ">http://www.microsoft.com </a>" target="_blank"><img alt="" border="0" src="/PublishingImages/add.gif" style="BORDER: 0px solid; "></a></span>

To rectify this issue i took Steffan’s approach as the baseline and modified the code to look like this:

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.IO;
using System.Web;
using System.Web.UI;
using Microsoft.SharePoint.Publishing.WebControls;

namespace CustomPublishingField
{
public class RichImageFieldControl: RichImageField
{
protected override void RenderFieldForDisplay(HtmlTextWriter output)
{
if (this.ListItemFieldValue != null)
{
StringBuilder item = new StringBuilder();
item.Append("<span dir=''>");
item.Append(this.ListItemFieldValue.ToString());
item.Append("</span>");
output.Write(item.ToString());
}
}
}
}

So what I did here is pretty simple. I am taking the value of the ListItemFieldvalue property of the control and wrapping it under span tags. This generates the correct html and as a result the image gets properly rendered with hyperlinks.