Skip to main content

Gig Werks Developer Team Blog

Go Search
Fairfield/Westchester Sharepoint User Group
Gig Werks Developer Team Blog
  

Categories
Development
Other Blogs
There are no items in this list.
Fairfield/Westchester Sharepoint User Group > Gig Werks Developer Team Blog
Mail Enabled Lists vs. The Missing Windows 2008 POP3/IMAP Server

I have been faced with a number of situations where I am asked to develop functionality related to mail enabled lists in SharePoint. Mail enabled lists are exactly what they sound like. They are lists which can be configured with an e-mail address so that users can add items by e-mailing the address designated to the list. For example, let's say I set up an announcement list and I gave it the address announcements@xyx.com, I could just write an e-mail to that address and that the body and subject line of the email would become a new announcement. You can't just make ANY list e-mail enabled in SharePoint. It has to be one of the following types:

  • Document, picture, or form library
  • Announcements list
  • Calendar list
  • Discussion board
  • Blog

Specific information on how to set this up can be found here. This is all very cool functionality to be sure, however there is one major catch. This catch is that you need have to have an e-mail infrastructure in place to be able to get this to work. For most production environments this means Microsoft Exchange. On a test environment this is generally something less involved, like setting up the SMTP and IMAP/POP3 services that are included as part of Windows 2003 Server.

Recently, I upgraded my development VM to use Windows 2008 Server. I did this because I wanted to become familiar with the new OS as I would imagine I'm going to be seeing a lot more 2008 production environments as time moves forward. So, I set up this really sweet Windows 2008 VM. It had everything. It was a domain controller, It had SQL Server, it had MOSS 2007, I set up reporting services (in integrated mode mind you). I had a separate virtual host set up in IIS for deploying WCF web services. I had Visual Studio 2008 and the new 1.2 version of the Visual Studio Extensions for SharePoint loaded up.

Things seemed to work really well until I needed to configure email enabled lists. As it turns out, Microsoft decided to discontinue the IMAP & POP3 component. This puts a big damper on reading any e-mail generated by SharePoint. Furthermore, the SMTP service was subjugated to a much deprecated role. Basically, so not to steal any of the IIS 7 thunder, they didn't include any kind of management SMTP management tool in the IIS 7 Internet Information Services Manager. You need to manage it from the rickety old IIS 6 console which displays some cryptic error messages when you click on the parts they decided not to wire up to this shinny new operating system.

So it looked like I had a real problem on my hands. How was I going to get mail to work? A few ideas went through my head:

  • I will just install Exchange 2007
    • WRONG: I have a 32-bit VM, I can't install Exchange which is now 64-bit only, on this image.
  • Ok, I will set up a 64-bit VM
    • WRONG: The sharepoint development tools don't exactly work on a 64-bit OS yet.
  • Hmm, go back to 2003 for my development sandbox?
    • WRONG: Turns out there is another solution.

Another company put together a quick and dirty solution to this very problem in the form of the Visendo SMTP Extender for Windows 2008 which I found out about here. It's basically a POP3 service that you can set up on Windows 2008 that works with the built in SMTP server. It's not exactly pretty, in fact there is NO management UI at all, you have to do everything with configuration files… but it gets the job done. Right now it's free.

7 Tools for SharePoint Developers

SharePoint 2007 is a pretty amazing product which does a lot of things out of the box. Sometimes however, the capabilities you are looking for are not part of the product and you need to do a little custom development. If you have tried to do this yourself, you may know that there are some gaps in the overall developer experience. As a consultant, I'm often asked what tools and utilities I use to create and deploy solutions. In this article I list a number of 3rd party and community tools which I have found to be very useful.

Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions, Version 1.2

To some extent, Microsoft has been dragging its feet in respect to development tooling for SharePoint. SharePoint has always been notoriously painful to develop for in comparison to the F5 to debug approach of ASP.Net and Windows Forms development.

Enter the Visual Studio 2008 Extensions for WSS 1.2. These extension add support for developing and debugging common SharePoint customizations such as site definitions and web parts. These tools are far from seamless but they do provide a path towards a more graceful development and debugging experience. The 1.2 version of the tools just came out in June and they support Visual Studio 2008. The word on the street is that the next version of these tools are going to be vastly improved and provide much more integrated (or at least a less kludgy) way to develop for SharePoint. I can't tell you how much I'm looking forward to it.

CodeRush

CodeRush is a Visual Studio Add-In developed by Devexpress. The tool provides a means to write common and repetitive code using a very intuitive and accessible shorthand notation. For example to add beautify formatted Try, Catch, Finally block you just type the letters tcf while your cursor is in the body of a method and BAM! There it is in your editor. The best thing is that it understands the context you are in. CodeRush knows that if you are defining a class you are going to be using different keywords than you would when you are editing code deep within a private method. It takes a little getting used to but once you do, you can save yourself a lot of time.

Like a couple of other tools, code rush is not SharePoint specific h however, SharePoint MVP Andrew Connell has created a set of CodeRush templates which can be used to for writing CAML for SharePoint Solutions. Andrew has a number of other great tools on his web site.

SharePoint Development Environment Modifications

Scot has, for quite some time, been the go-to guru on SharePoint and is arguably one of the most recognized names in the SharePoint community. His Development Environment Modifications project provides a quick and easy way to set up your development environment. The package includes a number of developer oriented STSADM extensions. Also include in the package are a number of Visual Studio tools for doing things such as making WSP files and managing IIS.

SmartPaster Visual Studio Add-In

The Smart Paster Add-In for Visual Studio really has nothing to do with SharePoint but it's an indispensable tool for anyone who uses Visual Studio. The Smart Paster allows you to paste text into your code as formatted code blocks such as comments, strings, regions and most importantly, String Builders. This is great for inline script such as JavaScript and/or SQL Statements, or dealing with any large strings. Granted, you probably shouldn't be hard coding a lot of this stuff but sometimes you gotta' do what you gotta' do.

AJAX Control Toolkit

The AJAX Control Toolkit is a collection of controls designed for use with ASP.Net AJAX. As of SP1, SharePoint officially supports the use of ASP.Net AJAX enabled controls. In the toolkit you will find a number controls which can be used add a lot of life to your web part without needing to have an extensive knowledge how AJAX works.

SharePoint 2007 Features

This codeplex project provides a number of convenient SharePoint features which assist in the development process. For example, there is a feature which can be used to update the web.config across the entire farm which is useful for setting up things like connection stirrings and application settings. . There is a feature that can be used to configured support for the 3.5 framework which is required in order to use features such as ASP.Net AJAX. In addition to this, there is a debugger feature which can assist in the process of connecting a debugger to a SharePoint application. Beyond this, there are also tools for administrators and end users.

MOSS Faceted Search

This really isn't a development tool per se; however the MOSS faceted search project on Codeplex enables you to extend the out of the box search capabilities by allowing users more easily navigate and refine search results. In many cases, this is the first tool I look to when a customer wants a richer search experience. The source code is available for this project so you can modify it to suit your needs if you want to do something a little differently.

 

Opening SharePoint Links in a new window

Many of us have seen the Links List in SharePoint. It is a widely used list type for intranets, extranets and internet facing sites not only for its simplicity but also for it's built in ability to reorder items. This is done by clicking on the Change Order link in the actions menu, and it is also accompanied with a great UI. This is a wonderful feature that custom lists and libraries unfortunately do not have out of the box.

Alas as great as the links library may be with all its Re-Ordering goodness, that shall not be the theme of this post. Oh no, even with all the work the brilliant SharePoint engineers in Redmond had put into this list type, it seems they dropped the ball on one glaringly obvious feature. As many of us have seen, one of the really annoying quirks is the lack of an "Open In new window" option. What I am referring to is when you add the links list as a web part to a page, clicking on a link navigates away from the SharePoint site instead of opening it up in a new window or tab. Now us computer savvy of course know the work around to this "Just tell the user to hold down the ctrl key". Unfortunately this does not fly with many end users, or customers. Now believe me I was a skeptic when it came to the urgency of this feature. On one of our recent projects our project manager had warned from the beginning this would be a huge deal, but I just brushed it off. Until of course we started receiving user feedback after the beta release. And low and behold the majority of the complaints didn't have anything do with Workflows or InfoPaths or any of that other nonsense. It was about that freakin Link List not opening in a new window! So then I was sold. Now the question becomes how do we accomplish this in SharePoint? Well the solution I came up with is by using a DataForm web part in SharePoint designer. You start by going to the task panes menu and activating the Data Source Library.

Then with the data source library open, click on the Links list you are interested in and click show data.

Now you are ready to create your dataform webpart. This is done by selecting the fields you want and then clicking Insert Selected Fields as "Multiple Item View". Since all we are interested in is the URL field, this is all you need to select. Interestingly, SharePoint stores both the URL Text and the Link in this one field delimited by a column but we'll get to that later.

Now once you do this, you should see a data form web part on the page rendering a basic Links List. The next step now is to get it looking like the default Links List style with the bulleted items. Lucky for you I already went through the trouble of formatting the XSL. Simply strip out the XSL stylesheet and replace it with this one:

 

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">

    <xsl:output method="html" indent="no"/>

    <xsl:decimal-format NaN=""/>

    <xsl:param name="dvt_apos">'</xsl:param>

    <xsl:variable name="dvt_1_automode">0</xsl:variable>

    <xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">

        <xsl:call-template name="dvt_1"/>

    </xsl:template>

    

    <xsl:template name="dvt_1">

        <xsl:variable name="dvt_StyleName">RepForm1</xsl:variable>

        <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />

        <TABLE Summary="Links" class="ms-summarycustombody" style="margin-bottom: 5px;" cellpadding="0" cellspacing="0" border="0">

            <xsl:call-template name="dvt_1.body">

                <xsl:with-param name="Rows" select="$Rows" />

            </xsl:call-template>

        </TABLE>

    </xsl:template>

    <xsl:template name="dvt_1.body">

        <xsl:param name="Rows" />

        <xsl:for-each select="$Rows">

            <xsl:sort select="@Order" data-type="number" order="ascending" />

            <xsl:call-template name="dvt_1.rowview" />

            

        </xsl:for-each>

    </xsl:template>

    <xsl:template name="dvt_1.rowview">

        <tr>

            <TD style="padding-bottom: 5px; vertical-align:middle;" class="ms-vb"><img src="/_layouts/images/square.gif" alt="" /></TD>

            <TD style="padding-bottom: 5px;padding-left: 5px;" class="ms-vb">

<A onfocus="OnLink(this)" target="_blank" href="{substring-before(@URL, ', ')}"><xsl:value-of select="substring-after(@URL, ', ')" /></A>

</TD>

        </tr>

    </xsl:template>

</xsl:stylesheet>    

The key here is the anchor tag that now has the attribute target="_blank" which means the link will open in a new window:

<A onfocus="OnLink(this)" target="_blank" href="{substring-before(@URL, ', ')}"><xsl:value-of select="substring-after(@URL, ', ')" /></A>

Also, you can see how it uses the substring-before and substring-after XSL functions to extract out the link and description from the field. The last thing to note is that we want to take advantage of the built in ordering functionality. This is why you will notice that I included the following tag:

<xsl:sort select="@Order" data-type="number" order="ascending" />

You have to specify the data-type="number" attribute or else SharePoint will treat the order numbers as alpha characters and sort incorrectly. I found this out the hard way because I used the data form properties window to apply the sorting automatically. Now the last step is to include the "order" field as one of the fields SharePoint queries in the data form web part. By default it omits this field, but you can fix this by clicking on the Current Data Source link and adding it as a queried field:

And we are done. Also just to point out, if you want this as a moveable web part simply wrap it in a web part zone. You can find that in the Insert menu:

Once added just make sure the web part zone surrounds the entire data form web part. Then when you browse to the page and edit it you will be able to modify the web part properties and even edit the xsl from the browser. If you are using a publishing site you will need to do this from a non-publishing page, and then export/import the web part to the page you want using SharePoint's web part exporting feature. Well I hope this post has helped you and saved you some pain staking time.

 

-Neil Barkhina

 

Welcome to Team Blog!

Members of the Gig-Werks Developer team will be posting here on various topics related to Sharepoint and other cool technologies. We encourage you to check back often.

 ‭(Hidden)‬ Admin Links