Wednesday, February 18, 2009

Tuesday, February 10, 2009

BizTalk 2006 Code Samples

This news is a little old now, but there are a whole heap of BizTalk Server Code samples that were released to MSDN back in June 06.
Take a look at this list:

Publishing and Consuming Web Services with SOAP HeadersThis sample demonstrates how to publish a BizTalk orchestration as a Web service with a SOAP header and how to consume the SOAP header from a Web service request message.

BAM and HAT CorrelationThis sample demonstrates how to use the enhanced BAM features, and how to customize BAM and HAT integration. This sample also includes a Windows Forms application customizing BAM and HAT integration for the sample BizTalk solution.

Consuming Web Services with Array ParametersThis sample demonstrates how to consume Web services with array parameters.

Extending the BizTalk Server Administration ConsoleThis sample demonstrates how to use the Microsoft Management Console (MMC) 2.0 Software Development Kit (SDK) to extend the functionality of the BizTalk Server Administration console with your own custom menu items, node items, new data items and views, or different views of existing data.

Viewing Failed Tracking DataThis sample uses Windows Forms to provide a simple interface to view and resubmit failed messages.

Inserting XML Nodes from Business RulesThis sample demonstrates how to insert nodes into an XML document and set their values from a business rule by using the XmlHelper class.

Using the Mass Copy FunctoidThis sample demonstrates the use of the Mass Copy Functoid to map a source hierarchy to a destination hierarchy without mapping each individual element by hand.

Using Role LinksThis sample demonstrates how to use role links and parties.

Split File PipelineThis sample uses the FILE adapter to accept an input file containing multiple lines of text into a receive location.

Using Enterprise Library 2.0 with BizTalk ServerThis sample demonstrates how to use Enterprise Library 2.0 with BizTalk Server.

Consuming Web ServicesThis sample demonstrates how to consume Web services in a messaging-only scenario, and without using the Add Web Reference option.

Console AdapterThis sample consists of a C# console application that instantiates and hosts an instance of the receive adapter. The adapter is a Visual Studio 2005 class library that invokes the BizTalk Server 2006 APIs.

Delivery NotificationThis sample demonstrates how acknowledgments work and how to use delivery notification.

Using Long-Running Transactions in Orchestrations This sample demonstrates how to use long-running transactions in orchestrations.

Using the Looping FunctoidThis sample transforms catalog data from one format to another by using the Looping functoid.

Mapping to a Repeating StructureThis sample demonstrates how to map multiple recurring records in an inbound message to their corresponding records in the outbound message in the BizTalk Mapper.

Parallel Convoy This sample demonstrates how to design the parallel convoy pattern in BizTalk Orchestration Designer.

Policy ChainingThis sample demonstrates how to invoke a policy from another policy by calling the Execute method of the Policy class exposed directly by the Microsoft.RuleEngine assembly.

Recoverable Interchange Processing Using Pipelines This sample demonstrates how to implement recoverable interchange processing.

Using the Table Looping Functoid This sample demonstrates the use of the Table Looping functoid in gated and non-gated configurations.

Using the Value Mapping and Value Mapping (Flattening) FunctoidsThis sample demonstrates the use of the Value Mapping and Value Mapping (Flattening) functoids to transform data between different message formats.

Direct Binding to an OrchestrationThis sample processes fictitious loan requests using orchestrations with ports that are directly bound to another orchestration

Direct Binding to the MessageBox Database in Orchestrations This sample processes fictitious loan requests using orchestrations with ports that are directly bound to the MessageBox database.

Using a Custom .NET Type for a Message in OrchestrationsThis sample processes fictitious
customer satisfaction survey responses from clients who spend time at different resort properties. Clients assign an overall satisfaction rating and can optionally enter a contact address and request a personal response. A request for a personal response generates a new message that is forwarded to a customer service application for tracking and follow-up.

Writing Orchestration Information as XML Using the ExplorerOM APIThe sample performs two tasks. First, it writes configuration information for all orchestrations defined for a BizTalk server into a user-specified XML file. It then optionally transforms the XML data into a simple HTML report. This is accomplished through a console application.

Correlating Messages with Orchestration InstancesThis sample receives a purchase order (PO) message from a fictitious customer and processes the purchase order message using correlation.

SSO as Configuration StoreThis sample provides an implementation of a sample class and a walkthrough that demonstrates how to use the SSO administrative utility and the SSOApplicationConfig command-line tool.

Atomic Transactions with COM+ Serviced Components in OrchestrationsThis sample demonstrates how atomic transactions work in orchestrations.

Exception Handling in OrchestrationsThis sample demonstrates how to handle exceptions in an orchestration.

Implementing Scatter and Gather PatternThis sample demonstrates how to implement the Scatter and Gather pattern using BizTalk Orchestration Designer.

Using the SQL Adapter with Atomic Transactions in OrchestrationsThis sample shows how to use the SQL adapter with atomic transactions to keep databases consistent.

Wednesday, February 4, 2009

Custom Alerts in SharePoint 2007

In SharePoint 2007 we have a great feature called Alerts, basically it sends an email when something in a list or library (or view) is changed. I’m sure I don’t need to tell anyone about them, but when it comes to actually applying them, it would be ideal to be able to customise the alerts for your own application.

So not only might you want to change the presentation of the email that you send as an alert, but you may also want set certain custom conditions for when an alert is triggered.
The alert template xml file is located in the 12 Hive at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\alerttemplates.xml, if you open the file you will see all the different alerts for each type of list/library.

Either make a backup of the original file, or create your own copy (we will register the alert file later) and rename the file eg. CustomAlertTempates.xml
Copy the GenericList node and paste below the other nodes and rename.

If you expand this node you will see the child nodes EventTypes, Format (Digest & Immediate), Properties, and Filters.

If we look at the Format Node first, there are two types of formatting available, Digest and Immediate. Each contains a large amount of xsl/html that controls the output html of the alert email. The digest node controls the daily/weekly summary alerts, and the immediate node controls the alerts sent immediately (obviously!).
Change some of the html in the Immediate node so you can test whether the alert is using your template, eg.

The next step is to register and test your new alert type. For this you use STSADM from the command prompt to register the new alert file for a particular Site Collection.

stsadm -o updatealerttemplates -url http://yoursite/sites/sitecollname -filename “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\CustomeAlertTemplates.xml”

Now to set a particular alert to use your new specific template, you can set the AlertTemplate for the list programmatically.

SPList spList = null;
spList = spWeb.Lists[listName];
SPAlertTemplate newTemplate = new SPAlertTemplate();
newTemplate.Name = “SPAlertTemplateType.MyCustomAlertType“;
spList.AlertTemplate = newTemplate;spList.Update();
Or you can create an individual alert programmatically…
SPAlert spAlert = spUser.Alerts.Add();
spAlert.Title = alertName;
spAlert.EventType = SPEventType.Modify;
spAlert.AlertFrequency = SPAlertFrequency.Immediate;
spAlert.AlertType = SPAlertType.List;
spAlert.List = spWeb.Lists[listName];
spAlert.Filter = QueryBuilder(spUser.Name);
SPAlertTemplate newTemplate = new SPAlertTemplate();
newTemplate.Name = “SPAlertTemplateType.MyCustomAlertType“;
spAlert.AlertTemplate = newTemplate;

Once this has been registered, recycle the web app application pool, or reset IIS, then test the new alert. You should find the email alert will now include your new HTML.
So that’s how to change the HTML of an alert, in the next post I’ll create a new custom filtering option that will appear through the UI.

TIP: By default the timer job that runs the alert jobs runs every 5 minutes. And if you’re debugging that can be a painfully slow process, unless you enjoy heaps of coffee breaks! Anyway I decided I didn’t need that much coffee, so I changed the alert timer job to run every minute instead of every five.

SPJobDefinitionCollection spJobs = SpWeb.Site.WebApplication.JobDefinitions;
foreach (SPJobDefinition job in spJobs)

if (job.Id.ToString() == TaskGuid)

string guid = job.Id.ToString();
string name = job.DisplayName;
SPMinuteSchedule newSchedule = new SPMinuteSchedule();
newSchedule.BeginSecond = 0;
newSchedule.EndSecond = 59;
newSchedule.Interval = minutes;
job.Schedule = newSchedule;

Sunday, February 1, 2009

Web Content Management

Web Content Management or WCM in short is one of the more interesting topics on MOSS. This blog aims to provide an overview of WCM, explain what is WCM, why is it special and more importantly, how is it useful for you.

So what is WCM in simple terms ?
WCM is a rich content authoring and management platform. It provides a set of controls and publishing features that allow the site owners to host content centric sites. It takes care of the site branding, publishing, content authoring, workflows etc. WCM forms a part of the Enterprise content management solution, which in turn forms a part of MOSS 2007. It also leverages the Office Word and Infopath.

In short it is a very scalable solution that separates the content and presentation, relieving the burden on the IT department.To better understand the solution that WCM provides, we need to understand the problem first.

Managing a content centric web site is by no means a simple task. In most of the organization, it will be the IT team that will have access to add new pages, maintain the pages and keep the site running smoothly. The content contributor has to undergo the overhead of approaching the IT staff for each and every change. This translates to longer process and higher cost of operation. Many a times the content will have to be edited a few times before it is correctly published.

This is where WCM comes into picture. WCM provides a platform. It defines the site branding, sets the templates, look and feel, authoring rules, publishing rules, workflows, various levels of securities etc.

The content contributor can now focus on his content alone and leave the development hassles aside. He simply submits his data. This will in turn validate the data, start the workflows, approval cycles and finally publish the content without the support of IT staff. The final content will be published in accordance with the look and feel of the rest of the site.
WCM incorporates all features in Microsoft content management server 2002 (MCMS). Microsoft has discontinued providing CMS as a separate product, but instead, it provides the enhanced version ( WCM ) along with MOSS 2007.

Some of the important features of the WCM are listed below.

  • Workflows
  • Search functionality
  • RSS facilities
  • Built in Caching mechanism
  • Supports multiple devices
  • Better Versioning mechanism
  • More events captured
  • Pluggable Authentication
  • Reusable Content
  • Web based management

Having said all this, Does this really make sense?
A content heavy web site will have frequent changes. New pages will be added by various contributors. Managing the new pages, recording the version history, validating data, format etc is a mammoth task. Creating a application to handle the same will cost a fortune. WCM automates most of the processes and brings the focus to what matters the most, the content. This way, the contributor will be able to focus more on the data and be able to publish the content in a quick efficient manner.
The process does not require support from the IT department as the contributor can himself manage the content online. Thus saving a lot of effort as well as money.
In short, WCM saves Time and Money. And that makes a lot of sense.