#SharePoint TypeScript TypeScript declarations for SharePoint JavaScript Object Model (JSOM) + lots of samples.
##Getting started Install NuGet package using package manager
PM> Install-Package sharepoint.TypeScript.DefinitelyTyped
or from npm @types
npm install @types/sharepoint --save
If you are using Visual Studio SharePoint projects you need to enable TypeScript build actions:
- Edit csproj source file (right-click on your project in VS -> Unload project, right click again -> Edit YourProject.csproj)
- Include the following code:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" />
- Reload project
- Don't forget to set "Deployment Type" to "No Deployment" for .d.ts files
TypeScript Templates is a set of Client-Side Rendering (CSR) templates and helper functions to change behaviour of standard forms. Install using NuGet
PM> Install-Package typescripttemplates
or using bower
bower install typescripttemplates --save
##Definitions coverage
- JavaScript Side Object Model (JSOM) core classes
- SP namespace, core classes (sp.js, SP.Runtime.js)
- SP.WebParts namespace (sp.js)
- SP.Utilities namespace (sp.js)
- SP.SOD namespace (init.js, included on every SharePoint page)
- SP.RequestExecutor class (sp.requestexecutor.js)
- mQuery framework (mquery.js, SharePoint 2013+ analogue for jQuery)
- SP.ListOperation (sp.core.js)
- Global variables -
_spPageContextInfo
,_spBodyOnLoadFunctions
,_spBodyOnLoadComplete
- Social object library
- SP.Sharing namespace (sp.js)
- SP.UserProfiles namespace (sp.userprofiles.js)
- SP.Social namespace (sp.userprofiles.js)
- Reputation model (reputation.js)
- SharePoint Client Side Rendering
- SPClientTemplates module (clienttemplates.js and clinetforms.js)
- Default form Templates (from clientsforms.js)
- Workflows
- SP.Workflow (sp.js) - 2010 style workflows
- SP.WorkflowServices (sp.workflowservices.js) - 2013 style workflows
- SharePoint UI elements:
- SP.UI.Notify (sp.core.js, sp.js)
- SP.UI.Status (sp.core.js, sp.js)
- SP.UI.Menu (sp.core.js, sp.js)
- SP.UI.ModalDialog (sp.ui.dialog.js)
- SP.UI.ApplicationPages (sp.js)
- CalloutManager (callout.js)
- SP.UI.Controls (sp.ui.controls.js)
- SPClientAutoFill (autofill.js)
- SPAnimation (sp.core.js)
- Client People Picker (clientpeoplepicker.js)
- SharePoint Search
- Microsoft.SharePoint.Client.Search (sp.search.js)
- Business Connectivity Services
- SP.BusinessData (sp.js)
- SharePoint Managed Metadata
- SP.Taxonomy (sp.taxonomy.js)
- SharePoint Publishing Infrastructure
- SP.Publishing (sp.publishing.js)
- SP.DocumentManagement (sp.documentmanagement.js)
- SP.Policy (sp.policy.js)
-
SharePoint online core library extensions
-
JsGrid\SPGantt (incomplete)
##Samples Besides the definitions, the project also contains many great samples of SharePoint JSOM usage. No doubt, all of them are made with TypeScript!
Currently we have the following samples:
- JSOM: Basic tasks in SharePoint using JSOM with TypeScript
- JSOM: Working with taxonomy with TypeScript
- mQuery: Sample dynamic table
- Client controls: Autofill sample
- Client Side Rendering: Custom list view
- Client Side Rendering: Complexity field
- Client Side Rendering: Conditional formatting
- Client Side Rendering: Form with tabs
- Client Side Rendering: Custom Field with Validator
- Client Side Rendering: Lookup field with search
- Workflow Services: Retrieve list of available workflow actions
- Search: Using search JSOM with TypeScript
- User Profiles: Retrieve properties for current user
- Social: Determine if the current user follows a site and follow it, if not yet
- App Part: App part with people picker
- Reputation: like items in list (thanks to Evgeny Vilkov!)
- Publishing: Create a publishing page
Samples project is made as a SharePoint-hosted app. Download project, open .sln file and run.
##Authors Stanislav Vyshchepan is SharePoint Server MVP, author, speaker, trainer, CEO and founder of own consulting company in Russia.
- Blog: http://blog.gandjustas.ru (in Russian)
- Twitter: @gandjustas
- E-mail: [email protected]
- Company site: http://vnextsoft.ru
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).
- Blog: http://markeev.com
- Twitter: @amarkeev