Project Description

High-quality (documented and strongly typed) TypeScript declarations for SharePoint 2013 JavaScript Object Model (CSOM) + lots of examples.

SharePoint TypeScript Definitions are now available via Nuget:http://nuget.org/packages/sharepoint.TypeScript.DefinitelyTyped

PM> Install-Package sharepoint.TypeScript.DefinitelyTyped

View full version history

Coverage

  1. Client Side Object Model (CSOM) core classes
    • SP namespace (ready)
    • SP.WebParts (ready)
    • SP.Utilities (ready)
    • SP.SOD (ready)
    • SP.RequestExecutor (ready)
    • mQuery (ready)
  2. Social object library
    • SP.Sharing (ready)
    • SP.UserProfiles (ready)
    • SP.Social (ready)
  3. SharePoint Client Side Rendering 
    • SPClientTemplates (ready)
  4. Workflows
    • SP.Workflow (ready)
    • SP.WorkflowServices (ready)
  5. SharePoint UI elements:
    • SP.UI.Notify (ready)
    • SP.UI.Status (ready)
    • SP.UI.Menu (ready)
    • SP.UI.ModalDialog (ready)
    • SP.UI.ApplicationPages - some useful stuff here nobody knows about e.g. ClientPeoplePickerWebServiceInterface! (ready)
    • CalloutManager (ready)
    • SP.UI.Controls (ready)
    • SPClientAutoFill (ready)
    • SPAnimation (ready)
  6. SharePoint Search
    • Microsoft.SharePoint.Client.Search (ready)
  7. Business Connectivity Services
    • SP.BusinessData (ready)
  8. SharePoint Managed Metadata
    • SP.Taxonomy (ready)
  9. SharePoint Publishing Infrastructure
    • SP.Publishing (ready)
    • SP.DocumentManagement (ready)
    • SP.Policy(ready)

Please, contribute your definitions!

Examples

Besides the definitions, the project also contains many great examples of SharePoint JavaScript CSOM usage. No doubt, all of them are made with TypeScript!

Currently we have the following examples:

  1. JSOM: Basic tasks in SharePoint using JSOM with TypeScript
  2. JSOM: Working with taxonomy with TypeScript
  3. mQuery: Sample dynamic table
  4. Client controls: Autofill sample
  5. Client Side Rendering: Custom list view
  6. Client Side Rendering: Complexity field
  7. Client Side Rendering: Conditional formatting
  8. Client Side Rendering: Form with tabs
  9. Client Side Rendering: Custom Field with Validator
  10. Client Side Rendering: Lookup field with search
  11. Workflow Services: Retrieve list of available workflow actions
  12. Search: Using search CSOM  with TypeScript
  13. User Profiles: Retrieve properties for current user
  14. Social: Determine if the current user follows a site and follow it, if not yet
  15. App Part: App part with people picker
  16. Reputation: like items in list (thanks to Evgeny Vilkov!)
  17. Publishing: Create a publishing page

Examples project is made as a SharePoint-hosted app.

You can download the example project from Downloads tab and try it out or explore examples source code in Source Code tab.

How to add definitions to existing project

  1. Install Visual Studio 2013 with Update 2 or the  TypeScript add-in  for Visual Studio 2012.
  2. Edit csproj source file (right-click on your project in VS -> Unload project, right click again -> Edit YourProject.csproj) and include the following code:
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" />
  3. Download the definitions file provided by this project (SharePoint.d.ts) and add this file to your project. This can also be done via Nuget:
    PM> Install-Package sharepoint.TypeScript.DefinitelyTyped
  4. Make sure that "DeploymentType" for SharePoint.d.ts is set to "NoDeployment". 
  5. Add a new TypeScript file to the project. You can add it either to a module (recommended) or to a SharePoint Mapped Folder. Set the "DeploymentType" for the .ts file to "NoDeployment", and make sure it is set to "ElementFile" (module) or "TemplateFile" (Mapped Folder) for the .js file
  6. Enjoy!

About Authors

Andrey Markeev is SharePoint Server MVP, online expert, active blogger, published author, frequent speaker. He works as a Senior SharePoint Consultant at NED Software Consulting Oy (Helsinki, Finland).

Stanislav Vyshchepan is SharePoint Server MVP, Solutions Architect at i-Teco (Moscow, Russia), Certified Trainer and SharePoint Development coach.

Last edited Oct 19 at 8:16 PM by omlin, version 54