Category Archives: Microsoft Office

SharePoint TechFest 2009 – Dallas, TX

I want to thank everyone who attended my session on SharePoint Workflow with Visual Studio at our TechFest event yesterday.  Please feel free to post any comments (good or bad) about my presentation or the event. 

Demo source code is posted on Nakido until the Techfest site is updated with session content.

SharePoint WorkFlow with Visual Studio – Downloads

SharePoint WorkFlow with Visual Studio – References it!

digg it!





Attach a Custom XML Schema to a Word Document Programmatically

If you find the need to add a custom XML schema to a Word document or other Office document programmatically, this function might come in handy.  This function uses the Word InterOp assemblies to attach a schema to a document.

using System;
using System.Xml;
using System.Xml.Schema;

using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;

/// <summary>
/// Attaches a custom xml schema to a document
/// </summary>
/// <param name="document">The Word document to modify</param>
/// <param name="schemaUrl">The url to the schema</param>
/// <param name="schemaNamespaceUri">The schema namespace defined in the schema</param>
/// <param name="schemaAlias">The alias used for the schema</param>
public static void AttachCustomXmlSchema(Word.Document document, string schemaUrl, 
            string schemaNamespaceUri, string schemaAlias)
        // Objects to use when passing strings as ref to word
        object schemaNamespaceUriObj = schemaNamespaceUri;
        object schemaAliasObj = schemaAlias;

        // Find the custom xml namespace (if we have one declared)
        Word.XMLNamespace customXmlNamespace = null;
            // Find the custom xml namespace
            customXmlNamespace = document.Application.XMLNamespaces.get_Item(ref 
        catch { };

        // Did we find it the namespace?
        if (customXmlNamespace == null)
            // We didn't find it
            // Add the custom xml schema to the available namespaces
            customXmlNamespace = document.Application.XMLNamespaces.Add(schemaUrl, 
                        ref schemaNamespaceUriObj, ref schemaAliasObj, true);

        // Attach the custom xml schema to the document
        object documentObj = document;
        customXmlNamespace.AttachToDocument(ref documentObj);
    catch (Exception ex)
        string attachFailed = string.Format("Unable to attach the {0} xml schema", 
        throw new ApplicationException(attachFailed);


Share This Post it!

digg it!




What is OBA anyway?

OBA (Office Business Applications) is using Microsoft Office products and related applications to put your applications in the hands of users where they spend most of their time every day, in Office applications.  It’s a ubiquitous term, but at the heart of it, OBA solutions deliver information and functionality from a variety of systems to the user where they need it most.

OBA’s can expose data from custom applications and ERP systems, or even merged data from multiple systems, and deliver custom UI’s and custom automation interfaces available directly in Word, Excel, PowerPoint or Outlook.  You can use VSTO tools to build Office Add-Ins and templates that can inject data from these applications into their documents, or simply to display inside these applications as users work. 

With Visual Studio 2008 and VSTO, Microsoft has made it easy to surface your data inside the Office suite in a variety of ways.  The flexibility is stunning, and will spin your head a bit.  The new toolset, and the integration of Office and Visual Studio, Microsoft has given us the power to build some amazing applications.

When you build OBA’s, you’ll be leveraging the following tools:

Microsoft Office SharePoint Server 2007 (MOSS)

  • Web Site Provisioning
  • Custom Lists and Document Libraries
  • Content Types
  • Business Data Catalog
  • Forms Server
  • Excel Services
  • BI Dashboards and KPI’s
  • Custom Features and Solutions
    • Custom Content Types
    • Custom Lists
    • Workflow
    • Event Receivers
    • Custom web parts

Office 2007

  • Document Information Panels
  • Custom Ribbon Add-In’s
  • Custom Task and Action Panes
  • Custom Add-Ins
  • Code-Behind Templates
  • Custom XML Parts
  • Word Custom Controls
  • Excel List Databinding
  • Excel User-Defined Functions

Visual Studio 2008 and the .Net Framework

  • SharePoint Project Types
  • Office Project Types
  • Integrated Debugging and UI Support
  • Click-Once Deployment

Here’s a list of resources to get you going

Transitioning to SharePoint 2007 (MOSS) Development

My background is in ASP.Net C# development.  I recently transitioned to SharePoint 2007 (MOSS) and OBA (Office Business Application) development.  As I learn, I hope to share my experiences here.

MOSS + Office + Visual Studio is a powerful toolkit – a platform for building productivity applications that goes way beyond building portals.  Throw in some Reporting Services, InfoPath, BI, AJAX, and SilverLight and things really get interesting.  It’s also a huge space, with a steep learning curve. I’ve learned a few things along the way, and I hope to find time to document some of them here to help others that want to make the transition or learn more about MOSS and OBA.

To get started, I recommend the following books, to be followed in the order listed.  Read them, build out your own lab environment, do the labs, absorb as much as possible, and you’ll be on your way.  It’s an exciting space, with much more to come.

Microsoft SharePoint: Building Office 2007 Solutions in C# 2005 (Expert’s Voice in Sharepoint) by Scot P. Hillier
An excellent overview of the functionality and capabilities of SharePoint 2007, WSS and MOSS. If you’re getting your feet wet with MOSS development, this is a great place to start. Includes complete labs that walk you through setting up a networked MOSS environment using VPC’s. My copy is heavily abused, I refer to it often.

Workflow in the 2007 Microsoft Office System by David Mann
A great reference for MOSS Workflow development. This is the only WF book I’ve found that covers custom MOSS workflow in-depth. If you’re doing your first custom MOSS workflow in Visual Studio, this book will save you lots of time and frustration.

Pro SharePoint Solution Development: Combining .NET, SharePoint and Office 2007 (Expert’s Voice in Sharepoint) by Ed Hild
Covers a bare minimum of MOSS basics and dives deep into custom Office solution development with real-world samples projects building OBA’s leveraging MOSS, Word, Excel, PowerPoint and Outlook. Covers custom feature development including content types, custom lists, custom actions and event receivers, BDC’s, Workflow, and Open Xml and document packaging code samples. Lots of useful code goodies.

Microsoft® Office SharePoint® Server 2007 Administrator’s Companion by Bill English
This book is a great reference book for SharePoint Administrative tasks and guidelines. Makes for a very boring read, but is an excellent reference for SharePoint infrastructure guidelines.