Whilst looking for information on how to make our MOSS 2007 Internet sites compliant with accessibility guidelines I found the following great post from Andrew Woodward -
If you use ASP.Net controls like the menu controls in your MOSS Internet sites these will be rendered using tables. To make the controls nice and accessible you can try using the css adapters found here -
The only downside of installing these on your sites is that they seem to make a bit of a mess of the site settings and manage content pages.
A great blog for links to MOSS information and other Microsoft related news -
I have a requirement to add several pages to a WCM enabled MOSS 2007 site programatically. To do this I needed to add page items to the pages list in the WCM site. To access the pages list you need to first get hold of the relevant site and cast it to a PublishingWeb. Once that has been done the content type is found and the page layout is chosen. At that point the page can be created, have values assigned to it and even be published and approved programatically.
The code to do this is:
//get site to add page to
SPSite Site = new SPSite(siteName);
SPWeb Web = Site.OpenWeb();
//cast it to a publishing site
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(Web)
//get Page content type - open the relevant content type to get it's GUID
SPContentTypeId ContentTypeID = new SPContentTypeId("0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3
//get page layout
PageLayout layouts = publishingWeb.GetAvailablePageLayouts(ContentTypeID);
PageLayout pageLayout = layouts;
//create a new page
PublishingPage newPage = publishingWeb.GetPublishingPages().Add("newPageName" + ".aspx", pageLayout);
newPage.ListItem["columnName"] = "Some Value"
SPFile listItemFile = page.ListItem.File;
//check that the file is not checked out - if it is check it in. This is more important when you have been modifying existing pages
if (listItemFile.CheckOutStatus != SPFile.SPCheckOutStatus.None)
Thread sleep is there in case you are adding many pages at once as this causes problems for the variations job and only the first page added is propagated. By adding a sleep the pages are added more slowly and the variation job works as expected!
With the addition of Windows Workflow Foundation in SharePoint 2007 the possibilities for the way lists are used in business processes are huge! With the inclusion of the friendly interface to create workflows in SharePoint designer it is amazingly easy to add custom workflows.
One of the most common requests I get is for a list item to be routed by email to a particular person based on one of the item values. Eg. If an item has the country field set to UK send an email to John Smith but if the country field is set to USA then send an email to Chuck Saltman. This is now extremely easy using the conditional workflows but it took a bit of fiddling about with the fields in the body of the email to produce a link to the current item.
The link to put into the body of the email message is as follows:
<a href="http://[serverName]/sites/[siteName]/Lists/[listName]/DispForm.aspx?ID=[%[listName]:ID%]">Link to item</a>
So in the case of a list called Products this would be:
<a href="http://[serverName]/sites/[siteName]/Lists/Products/DispForm.aspx?ID=[%Products:ID%]">Link to item</a>
Introduction to SharePoint Designer workflow
I have recently been looking at using the SQL 2005 XML column to store data that will eventually be used to create web pages in MOSS 2007. The first issue I faced was how to get the XML out of the column!
The first attempt involved reading it out as a string and using the System.Xml namespace in C# to manipulate the string, get nodes etc. I felt like there must be a better way and eventually came across the following article on XQuery:
For those that don't want to trawl the whole article the syntax for selecting an XML data point is as follows:
[XML Column Name].query(‘data([path to data point])')
From [Table Name]
So in my specific case this would be:
Attributes.query('data(//product/volumesolid)') as volumesolid,
Attributes.query('data(//product/dft)') as dft,
Another useful article to understand when to use the XML column in SQL is ‘XML best practices with SQL 2005’ - http://msdn2.microsoft.com/en-us/library/ms345115.aspx