Extending SharePoint 2010 tooling in Visual Studio 2010

Extensibility points

  • Already had: Macros, add-ins and packages
  • New extensions based on MEF
  • VSIX model simplifies distribution and deployment

VSIX Package

  • A zip package
  • Contains am .XML manifest
  • Install by double-clicking

Managed Extensibility Framework (MEF)

  • Part of .NET 4.0
  • An extensible app "imports" functionality
  • An extensible componet "exports" its functionality
  • An application catalog tracks instances of imported component
  • An application is composed by dynamically loading components

SharePoint Tools export extensibility interfaces

  • The interfaces: ISharePointProjectExtension, IProjectItemExtension, IDeploymentStep, IExplorerNodeTypeExtension (though these may change for beta 2 release)
  • Your custom extensions export these interfaces, e.g. :

[Export(typeof(ISharePointProjectExtension))] 
internal class myClass : ISharePointProjectExtension {
     public void Initialize(...)
    
     /* add event handlers /
    
     void projectService_ProjectMenuItemsRequested(...) {
          /
Add your options to the project menu /
     }
}

  • Requires applying MEF attributes to export each interface
  • MEF attributes written to the catalog at installation

Calls to SharePoint

  • The trick is that VS is 32-bit and SharePoint is 64-bit, so if you want VS to execute SharePoint operations, you need to use a special SharePointCommand type that will marshal the code for you for execution in a 64-bit thread. The Client OM would be a simpler option if you don't need to elevate permissions.

 Designers

  • You can build WPF extensions to VS2010 and there will be a number of community projects that do exactly that, or provide templates for custom designers.

Notes from a SharePoint Conference 2009 (#spc09) presentation by Ted Pattison and John Flanders.

No Comments