Thursday, July 31, 2008

A very nice tool

This CAML builder tool is pretty nice. If you're like me and haven't memorized the CAML spec, it's incredibly useful to test your query in this and then paste them into your code.

U2U CAML Query Builder

IMPORTANT NOTE: When using the trying to Query a list, remove the <Query> tags from the query otherwise the query wont do anything aside from return the whole list!!

Wednesday, July 30, 2008

Build a Standalone VM for MOSS Development (or WSS Development)

This post is a fantastic starting place for building your own developer VM with SQL Server, AD, Email, MOSS, and Visual Studio.

You should pretty much follow this verbatim, but here are a few points to make things go smoothly

  1. When Setting up SharePoint Search, make sure you include the Domain with the username (or you'll get a cryptic error)
  2. After setting up SharePoint Search, if you're installing MOSS, turn on all the other services except for the document conversion related services.
  3. If installing MOSS, make sure you create an SSP.
  4. Don't delete the default web application, just stop it. Chances are deleting it won't hurt you but there are a few things that could get screwed up if you totally delete the default web application (for more info see this post).
  5. Do yourself a favor and put STSDEV on there.

Tuesday, July 29, 2008

The call to SPSearchServiceInstance.Provision (server 'NTS499') failed. Setting back to previous status 'Disabled'.

I was creating a stand alone dev machine the other day and ran into this error. The simple fix is that you need to put in the accounts that the Search service will run as with their domain names. (E.g. DOMAIN\username, not just username)

Quick and easy...

Friday, July 25, 2008

Turn on anonymous access

In order to turn on anonymous access (I had to do it so my XML Web Part could use a list's RSS Feed as an XML source) follow these steps.

  1. Enable Anonymous access on your Web Application in Central Admin. Go to 'Application Management' and choose the 'Authentication Providers' link.
  2. Choose your authentication provider in the appropriate zone and check 'Enable Anonymous Access'.
  3. Go to your site and turn on Anonymous Access by going to 'Site Settings' then 'Advanced Permissions'
  4. If there is no 'Settings' option in your advanced permissions list, then your site is inheriting permissions, you can either stop inheriting by clicking 'Actions'>'Edit Permissions' (after which the 'Settings' option will show, or you can choose to turn anonymous access on at the parent's level by choosing 'Manage Parent Permissions'
  5. Once you have the 'Settings' menu, choose Anonymous Access and turn it on at the Site or List level. (For anonymous RSS you only need list level).

Using RSS and XML Web Part

I really like the XML Web Part because of its simplicity - take an XML data source, apply XSLT and have it pretty much whatever you want.

I was recently asked to create a jump-to-list-item dropdown box so that you could place the web part on any page and a user could select an item from that list from a dropdown and it would take them to the list item. Here are the steps that it took to create this using the out of the box XML Web Part.

  1. Turn on anonymous access on your list (here's how to do it)
  2. RSS Enable your list and then view the RSS Feed (you can do this through the list's Action menu)
  3. Place an XML Web Part on your page
  4. Modify the settings of the XML web part by pasting your RSS Feed URL into the webpart's XML Source attribute.
  5. Open the XSLT editor and place the following code:


    <?xml version="1.0"?>

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:template match="/">

    <select id="jumpDD">
    <option>
    Select
    </option>

    <xsl:for-each select="rss/channel/item">

    <option>
    <xsl:attribute name="value">
    <xsl:value-of select="link"/>
    </xsl:attribute>

    <xsl:value-of select="title"/>
    </option>
    </xsl:if>

    </xsl:for-each>
    </select>

    <input class='webPartJump' onclick="window.location.href=jumpDD.options[jumpDD.selectedIndex].value;" onfocus="this.blur()" type="button" value="Go" />

    </xsl:template>
    </xsl:stylesheet>

  6. *Optional: I did this for a Wiki Page Library so I wanted the wiki page to open directly instead of opening the item (which contained the page). In the RSS Settings for the list you can specify to open the document directly instead of going to the item.
There are tons of options with the XML Web Part. (I just wish you could use OWSSVR.dll to provide list XML for you, but sadly I don't think the XML Web Part will pass credentials).

...sounds like a project for the future...

Thursday, July 24, 2008

Email Enabled Lists

After lots of digging, I finally got incoming-email-to-list functionality working in MOSS. Take a look at Steve Smith's excellent tutorial on getting things set up here. I had several issues during my setup, but here are the highlights:
  • Get things configured first using a machine-name/sub-domain first (i.e. use email@servername.company.com instead of email@company.com)
  • The MS least-privilege configuration doesn't apply here - each web application with lists that you want to be email-enabled must use the same app-pool identity as Central Administration (i.e. the "farm account"). Note that you can (and should) still have separate app-pools, but they have to run using the same identity.
  • Don't forget to delegate control to the app-pool identity for making changes in AD. After getting frustrated I just granted full-control to the OU and then went back later and fixed it.
  • Make sure the Sharepoint Timer service is running, otherwise the emails will just sit in the maildrop folder on your SMTP server and they'll never make it to a list. Trust me.
  • I should be kicked for this... Make sure the user account that you are using to test actually has rights to post to the list. As far as I can tell, MOSS doesn't send you any sort of "post rejected" email to let you know, so you'll be chasing your tail. Again, trust me.

Tuesday, July 15, 2008

Create Custom Applications Pages

At some point, in your WSS or MOSS customization and development process, you'll likely need to create a Custom Application pages. Custom application pages differ from site pages in that they are compiled and not customizable by the user. (to learn more about application pages click here).

If you'd like another good sample project to work off of, check out the CustomApplicationPages download Ted Pattison Group's download section.

I'd also like to point out that Ted covers the specifics of this download in his book Inside Microsoft Windows SharePoint Services 3.0 which you can purchase in our SharePointers store.