Visual Studio 2010 SharePoint by znr91839


									Visual Studio 2010 SharePoint
     Tools E t     ibilit
     T l Extensibility

        Wouter van Vugt
      Critical Path Training
The Developer of SharePoint

• Cumbersome Development Model
• Bad Tool vs SKU Ratio ☺
The Developer of SharePoint

• Much improved framework
• Some improved tools
   ●   VSeWSS
   ●   Community Tools
The Developer of SharePoint
Yet To Come

• Fantastic tools
• Fully integrated into
  Visual Studio
   ●   Source control
   ●   Automated builds
• Focus on packaging and
• Easily extensible
Visual Studio 2010
The SharePoint Project System

• New Project System in Visual Studio 2010
   ●   Local Install of SharePoint
   ●   x64 Operating System
   ●   SharePoint Foundation / SharePoint Server

• Extensibility does not have to be difficult!
   ●   M      d APIs
       Managed API
   ●   Discovery through MEF
   ●   Packaging through VSIX
   ●   No Package Load Keys needed
Visual Studio 2010
Areas of Extensibility
                                                           Extend Explorer Nodes
                                                           Create Explorer Nodes

Create Deployent Steps
  Create Deployment

                            Deployment   Exploration

                                 g g
                            Packaging     Content

                                                           Extend Projects
Extend Package Validation                                Extend Project Items
 Custom MSBuild Scripts                                C t P j t It        T
                                                       Create Project Item Types

• Hello Visual Studio Extensibility
SharePoint Explorer Extensibility
Sh   P i tE l       E t   ibilit

• Extend nodes
  ●   Add context menu
  ●   Show custom
      Sh        t
  ●   Add child nodes

• Create nodes
  ●   Display custom
Interacting with Sh
I t    ti             P i t
             ith SharePoint
Extending E l   N d
E t di Explorer Nodes

• Implement IExplorerNodeTypeExtension
  Mark l      ith [ExplorerNodeType] and
• M k class with [E l      N d T   ] d
   public class MySiteNodeExtension : IExplorerNodeTypeExtension
       public void Initialize(IExplorerNodeType nodeType)
           nodeType.NodeChildrenRequested += 
           nodeType.NodeMenuItemsRequested += 
           nodeT pe NodeMen ItemsReq ested +  
           nodeType.NodePropertiesRequested += 
              NodeType NodePropertiesRequested;
Creating E l  N d
C ti Explorer Nodes

• Implement IExplorerNodeTypeProvider
  Mark l      ith [ExplorerNodeType] and
• M k class with [E l      N d T   ] d
   public class MySiteNodeExtension : IExplorerNodeTypeProvider
       public void InitializeType(
               l      d       fi iti   t     fi iti )
           IExplorerNodeTypeDefinition typeDefinition)
           typeDefinition.IsAlwaysLeaf = true;
Calling SharePoint APIs
C lli Sh     P i t API

• Strongly Typed Calls into separate 64-bit
   class MyItemInfo
     public string Field{ get; set;}

   ISharePointProjectService projectService;
   ISharePointConnection connection = 

   MyItemInfo info   connection.ExecuteCommand<string, MyItemInfo>(
   MyItemInfo info = connection.ExecuteCommand<string, MyItemInfo>(
     "MyCommandID", "argument");

• Creating Explorer Nodes
  ●   Showing Web Parts in the SharePoint
SharePoint Project Items
Sh   P i t P j t It

             <xml />
            SPData file
Steps to create new templates
St    t      t      t   l t

• Create the Visual Studio template
  ●   Deployed as a ZIP
  ●   Use VSPackage Build Action
• Enable Item Templates in the VSIX
             code behind
• Implement ‘code behind’
  ●   Makes the content dynamic
  ●   Can support refactoring
Creating P j t It
C ti Project Items

• Implement ISharePointProjectItemTypeProvider
  Mark l       ith [SharePointProjectItemType]
• M k class with [Sh P i tP j tIt T          ]
  and [Export]
public class MyCustomItem : ISharePointProjectItemTypeProvider
    public void InitializeType(
         Sh     i t   j t t         fi iti   d f)
        ISharePointProjectItemTypeDefinition def)
        def.SupportedDeploymentScopes = SupportedDeploymentScopes.Site;
        def.SupportedTrustLevels = SupportedTrustLevels.All;
        def S pportedTr stLe els   S pportedTr stLe els All;
        def.SupportedAssemblyDeploymentTargets = 

• Creating Project Items
Automated Packaging
A t   t dP k i

• MSBuild based packaging

     b ild SharePointProject1.csproj /t:Package 
   msbuild Sh     i t   j t        j /t    k

                       j       p j /                g
  msbuild SharePointProject1.csproj /t:ValidatePackage 
Deploying Sh P i t S l ti
D l i SharePoint Solutions
Sometimes you need a full deploy

         Sometimes just a quick refresh

P h            d fresh it     ll ti
Perhaps you need a f h site collection

Or you need to reset a service, just to be sure
SharePoint P j t D l
Sh                          t
     P i t Project Deployment

• Available only inside the
  Visual Studio 2010 IDE

• Steps grouped in

• Extensible with custom
  deployment steps
Creating D l  t St
C ti Deployment Steps

• Implement IDeploymentStep
  Mark l      ith [DeploymentStep] and [Export]
• M k class with [D l       tSt ] d [E       t]

public class MyCustomStep : IDeploymentStep
    public void Initialize(IDeploymentStepInfo stepInfo) {

    public bool CanExecute(IDeploymentContext context) {
        ret rn tr e;
        return true;

    public void Execute(IDeploymentContext context) {

• Creating Deployment Steps
  ●   Refreshing the site collection

• Automating Deployment
  ●   Two second integration
Community Kit for SharePoint
Dev Edition


• Community Extensions
  ●   X-Copy
      X Copy Deployment
  ●   Solution Upgrades
  ●   Auto Deployment
  ●   Sandboxed Visual Web Part
  ●   Linq to SharePoint Classes
  ●   SharePoint References Tab
  ●   And much more…

      Drop by in the post conference to learn more!
Your F db k is Important
Y    Feedback i I   t t

 Please fill out a session evaluation form
  d        ff t th      f          i t ti
  drop it off at the conference registration

                Thank you!

To top