Deep-dive building solutions on the SharePoint Framework

12
4th of March 2017 @MS HQ Munich Deep-dive building solutions on the SharePoint Framework Waldek Mastykarz, Rencore, Microsoft MVP #SPSMUC15

Transcript of Deep-dive building solutions on the SharePoint Framework

Page 1: Deep-dive building solutions on the SharePoint Framework

4th of March 2017

@MS HQ Munich

Deep-dive building solutions on theSharePoint FrameworkWaldek Mastykarz, Rencore, Microsoft MVP #SPSMUC15

Page 2: Deep-dive building solutions on the SharePoint Framework
Page 3: Deep-dive building solutions on the SharePoint Framework

rencore.com

Deep-dive building solutions on the

SharePoint Framework

Page 4: Deep-dive building solutions on the SharePoint Framework

Store project dependencies

$ npm install angular --save

package.json

{dependencies: {

"angular": "^1.5.8"}

}

Page 5: Deep-dive building solutions on the SharePoint Framework

Don’t bundle frameworks. Load from URL instead

config/config.json

{externals: {

"angular": {"path": "https://cdn.com/…/angular.min.js","globalName": "angular"

}}

}

Page 6: Deep-dive building solutions on the SharePoint Framework

Don’t guess the JavaScript framework format

http://rencore.com/spfx/script-check/

Page 7: Deep-dive building solutions on the SharePoint Framework

Use one-time bootstrap

MyWebPart.ts

export default class ToDoWebPartWebPart extends BaseClientSideWebPart<IToDoWebPartWebPartProps> {

public render(): void {if (this.renderedOnce === false) {

// one-time bootstrap}

}}

Page 8: Deep-dive building solutions on the SharePoint Framework

Use SharePoint Framework libraries to share code

react-recentdocuments-service.manifest.json

{  "$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",

  "id": "69b1aacd-68f2-4147-8433-8efb08eae331",  "alias": "DocumentsService",  "componentType": "Library",  "version": "0.0.1",  "manifestVersion": 2}

Page 9: Deep-dive building solutions on the SharePoint Framework

Use SharePoint Framework services

DocumentsService.ts

import { ServiceScope, ServiceKey } from '@microsoft/sp-core-library';import { Promise } from 'es6-promise';

export class DocumentsService implements IDocumentsService {    public static readonly serviceKey: ServiceKey<IDocumentsService> = ServiceKey.create<IDocumentsService>('contoso:DocumentsService', DocumentsService);    

    constructor(serviceScope: ServiceScope) {    }

    public getRecentDocument(): Promise<IDocument> {    }

    public getRecentDocuments(startFrom: number = 0): Promise<IDocument[]> {    }}

Page 10: Deep-dive building solutions on the SharePoint Framework

rencore.com

Next steps• Get started at aka.ms/spfx• Build better solutions with SPCAF: rencore.com/spfx

• Share your feedback at aka.ms/spfx-issues

Page 11: Deep-dive building solutions on the SharePoint Framework

Please visit our sponsors who made this day possible!

Thank you!Rate this session with the event app

http://app.spsmuc.com

Page 12: Deep-dive building solutions on the SharePoint Framework

rencore.com

Waldek MastykarzOffice Development MVPhttps://blog.mastykarz.nl@waldekmhttps://www.rencore.com