Visual Studio 2010 SharePoint by znr91839

VIEWS: 26 PAGES: 25

									Visual Studio 2010 SharePoint
     Tools E t     ibilit
     T l Extensibility

        Wouter van Vugt
      Critical Path Training
           @woutervugt
The Developer of SharePoint
Past


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


• 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
  deployment
• 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
    Configurations


                            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
Demo

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

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


• Create nodes
  ●   Display custom
      artifacts
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
  [Export]
   [ExplorerNodeType(ExplorerNodeTypes.SiteNode)]
   [Export(typeof(IExplorerNodeTypeExtension))]
   public class MySiteNodeExtension : IExplorerNodeTypeExtension
   {
       public void Initialize(IExplorerNodeType nodeType)
       {
           nodeType.NodeChildrenRequested += 
              NodeType_NodeChildrenRequested;
           nodeType.NodeMenuItemsRequested += 
           nodeT pe NodeMen ItemsReq ested +  
              NodeType_NodeMenuItemsRequested;
           nodeType.NodePropertiesRequested += 
              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
  [Export]
   [ExplorerNodeType(“MyExplorerNodeID”)]
   [Export(typeof(IExplorerNodeTypeProvider))]
   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
  process
   [Serializable]
   class MyItemInfo
   {
     public string Field{ get; set;}
   }




   ISharePointProjectService projectService;
   ISharePointConnection connection = 
     projectService.SharePointConnection;

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

• Creating Explorer Nodes
  ●   Showing Web Parts in the SharePoint
        p
      Explorer
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
  container
             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]
[SharePointProjectItemType("MyCustomItemID")]
[Export(typeof(ISharePointProjectItemTypeProvider))]
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 = 
           SupportedAssemblyDeploymentTargets.All
    }
}
Demo

• 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
  deployment
  configurations

• 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]

[DeploymentStep("MyCustomStepID"), 
Export(typeof(IDeploymentStep))]
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) {
    }
}
Demo

• Creating Deployment Steps
  ●   Refreshing the site collection
Demo

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

                 http://cksdev.codeplex.com

• 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
                      desk.

                Thank you!

								
To top