deep dive building solutions on the sharepoint framework - sps brussels 2016

16
SharePoint Saturday Belgium 2016 • October 15 • Brussels Track: Developer | Level: 300 Deep Dive building solutions on the SharePoint Framework Waldek Mastykarz Office Development MVP | Rencore

Upload: waldek-mastykarz

Post on 24-Jan-2017

515 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels Track: Developer | Level: 300

Deep Dive building solutions on the SharePoint Framework

Waldek MastykarzOffice Development MVP | Rencore

Page 2: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

Platinum

Gold

Silver

Page 3: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Working withSharePoint Framework

Page 4: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Store project dependencies$ npm install angular --save

package.json

{dependencies: {

"angular": "^1.5.8"}

}

Page 5: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Don’t bundle frameworks. Load from URL insteadconfig/config.json

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

}

Page 6: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Don’t guess the JavaScript framework formathttp://rc-scripttype.azurewebsites.net/

Page 7: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Non-AMD scripts in web parts• Isolated within web part• Each web part uses its own version• Version loaded by one web part doesn’t affect the version loaded by another

web part

• Exposed in the global scope• Last version loaded overwrites any version loaded previously in the global

scope

Page 8: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Avoid using non-AMD scripts whenever possible

Page 9: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Clean old project build files$ gulp nuke

Page 10: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Use one-time bootstrapMyWebPart.ts

export default class ToDoWebPartWebPart extends BaseClientSideWebPart<IToDoWebPartWebPartProps> {

public render(): void {if (this.renderedOnce === false) {// one-time bootstrap}}

}

Page 11: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Use non-reactive pane with external dataMyWebPart.ts

export default class ToDoWebPartWebPart extends BaseClientSideWebPart<IToDoWebPartWebPartProps> {

protected get disableReactivePropertyChanges(): boolean {

return true;}

}

Page 12: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Validate web part properties valuesMyWebPart.ts

PropertyPaneTextField('description', {label: strings.DescriptionFieldLabel,onGetErrorMessage: this.validateDescription.bind(this)

})

private validateDescription(description: string): string {if (description && description.length > 20) {return 'Description shouldn\'t be longer than 20 characters';}else {return '';}

}

Page 13: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

Next steps1. Get SPFx

http://wldk.nl/spfx-setup

2. Check out docshttp://wldk.nl/spfx-docs

3. Check out sampleshttp://wldk.nl/spfx-samples

4. Latest SPFx contenthttp://wldk.nl/waldek-blog

Page 14: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

Waldek MastykarzOffice Development MVP

Rencorehttp://www.rencore.com

https://blog.mastykarz.nl@waldekm

Page 15: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

SharePoint Saturday Belgium 2016 • October 15 • Brussels

Thank You!

Page 16: Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016

Feedbackhttp://spsbe.be