SlideShare a Scribd company logo
1 of 16
IIS Express
Project Templates
private _getListItemEntityTypeFullName(context: IWebPartContext):Promise<string> {
if (this._listItemEntityTypeFullName){
return Promise.resolve(this._listItemEntityTypeFullName);
}
return context.spHttpClient.get(context.pageContext["web"]["absoluteUrl"]
+ `/_api/web/lists/GetByTitle('${this._listName}')`, SPHttpClientConfigurations.v1)
.then((response: Response) => {
return response.json()
})
.then((value) => {
this._listItemEntityTypeFullName = value["ListItemEntityTypeFullName"];
return value["ListItemEntityTypeFullName"];
});
}
export interface IListItem {
Id: number;
Title: string;
}
public getListItems(): Promise<IListItem[]> {
return this.context.spHttpClient.get(this.context.pageContext["web"]["absoluteUrl"]
+ `/_api/web/lists/GetByTitle('${this._listName}')/items?$select=Id,Title`, SPHttpClient.configurations.v1
)
.then((response: Response): Promise<any> => {
return response.json();
})
.then((data: any) : IListItem[] =>{
this._showSuccess(`Successfully loaded ${data.value.length} items`);
return data.value;
}, (error: any): void => {
this._showError(`Loading all items failed with error: ${error}`);
}) as Promise<IListItem[]>;
}
const reqJSON: any = JSON.parse(
`{
"@odata.type": "${this._listItemEntityTypeFullName}",
"Title": "${title}"
}`);
this.context.spHttpClient.post(
this.context.pageContext["web"]["absoluteUrl"] +
`/_api/web/lists/GetByTitle('${this._listName}')
/items?$expand=ListItemAllFields`,
SPHttpClient.configurations.v1,
{
body: JSON.stringify(reqJSON),
headers: {
"accept": "application/json",
"content-type": "application/json"
}
}
)
.then((response: SPHttpClientResponse): Promise<IListItem> => {
return response.json();
})
const reqJSON: any = JSON.parse(
`{
"@odata.type": "${this._listItemEntityTypeFullName}",
"Title": "${title}"
}`);
this.context.spHttpClient.post(
this.context.pageContext["web"]["absoluteUrl"] +
`/_api/web/lists/GetByTitle('${this._listName}')/items(${Id})`,
SPHttpClient.configurations.v1,
{
body: JSON.stringify(reqJSON),
headers: {
"IF-MATCH": "*",
"X-HTTP-Method":"MERGE",
"accept": "application/json",
"content-type": "application/json"
}
})
.then((response: SPHttpClientResponse): void => {
this._showSuccess(`Item with ID: ${Id} successfully updated`);
}, (error: any): void => {
this._showError(`Error updating item: + ${error}`);
});
this.context.spHttpClient.post(
this.context.pageContext["web"]["absoluteUrl"] +
`/_api/web/lists/GetByTitle('${this._listName}')/items(${Id})`,
SPHttpClient.configurations.v1,
{
headers: {
"IF-MATCH": "*",
"X-HTTP-Method":"DELETE",
"accept": "application/json",
"content-type": "application/json"
}
})
.then((response: SPHttpClientResponse): void => {
ContainerNode.parentNode.removeChild(ContainerNode);
this._showSuccess(`Item with ID: ${Id} successfully deleted`);
}, (error: any): void => {
this._showError(`Error deleting item: ${error}`);
});
 Use Office UI Fabric React
components
 Use state to keep track of Web
Part status and data
 Use the web part's HttpClient in a
React component
 Load Angular
and ngOfficeUIFabric from CDN
 Use conditional rendering for
one-time web part setup
 Pass web oart configuration to
Angular and react to
configuration changes in the
Angular application
 Use the SP PnP JS library with
SharePoint Framework Client-
Side web parts
 Configure global request headers
and override them for specific
requests, as needed
 Sort and select the top n items
from a list with the fluent API
Code samples and
solutions
Reusable components
Guidance documentation
Monthly community calls
SharePoint Framework
SharePoint add-ins
Microsoft Graph
Office 365 APIs
Sharing is caring…
http://aka.ms/SharePointPnP
SPFx working with SharePoint data
SPFx working with SharePoint data
SPFx working with SharePoint data

More Related Content

What's hot

Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Rafael Felix da Silva
 
Recompacting your react application
Recompacting your react applicationRecompacting your react application
Recompacting your react applicationGreg Bergé
 
Scala for the web Lightning Talk
Scala for the web Lightning TalkScala for the web Lightning Talk
Scala for the web Lightning TalkGiltTech
 
exportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailboxexportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailboxDaniel Gilhousen
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 ArchitectureEyal Vardi
 
Deep Dive into React Hooks
Deep Dive into React HooksDeep Dive into React Hooks
Deep Dive into React HooksFelix Kühl
 
Synchronize applications with akeneo/batch
Synchronize applications with akeneo/batchSynchronize applications with akeneo/batch
Synchronize applications with akeneo/batchgplanchat
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8Mohd Harris Ahmad Jaal
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0Eyal Vardi
 
F# in the enterprise
F# in the enterpriseF# in the enterprise
F# in the enterprise7sharp9
 
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...SPTechCon
 
Example asset
Example assetExample asset
Example assetSun Malen
 
What's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancementWhat's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancementKenichiro Nakamura
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in AngularYadong Xie
 

What's hot (20)

Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012
 
Recompacting your react application
Recompacting your react applicationRecompacting your react application
Recompacting your react application
 
Scala for the web Lightning Talk
Scala for the web Lightning TalkScala for the web Lightning Talk
Scala for the web Lightning Talk
 
exportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailboxexportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailbox
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
 
Deep Dive into React Hooks
Deep Dive into React HooksDeep Dive into React Hooks
Deep Dive into React Hooks
 
Actions & Filters In WordPress
Actions & Filters In WordPressActions & Filters In WordPress
Actions & Filters In WordPress
 
Synchronize applications with akeneo/batch
Synchronize applications with akeneo/batchSynchronize applications with akeneo/batch
Synchronize applications with akeneo/batch
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
 
F# in the enterprise
F# in the enterpriseF# in the enterprise
F# in the enterprise
 
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Example asset
Example assetExample asset
Example asset
 
Android crashcourse
Android crashcourseAndroid crashcourse
Android crashcourse
 
What's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancementWhat's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancement
 
Ruby - Design patterns tdc2011
Ruby - Design patterns tdc2011Ruby - Design patterns tdc2011
Ruby - Design patterns tdc2011
 
Backendless apps
Backendless appsBackendless apps
Backendless apps
 
Angular 2.0 - What to expect
Angular 2.0 - What to expectAngular 2.0 - What to expect
Angular 2.0 - What to expect
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in Angular
 
Android - Saving data
Android - Saving dataAndroid - Saving data
Android - Saving data
 

Similar to SPFx working with SharePoint data

Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017Codemotion
 
Scala in practice
Scala in practiceScala in practice
Scala in practicepatforna
 
Protocol-Oriented Networking
Protocol-Oriented NetworkingProtocol-Oriented Networking
Protocol-Oriented NetworkingMostafa Amer
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Creating an Uber Clone - Part XXXX.pdf
Creating an Uber Clone - Part XXXX.pdfCreating an Uber Clone - Part XXXX.pdf
Creating an Uber Clone - Part XXXX.pdfShaiAlmog1
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!Sébastien Levert
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceNCCOMMS
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptRyan Anklam
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseHeiko Behrens
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using RoomNelson Glauber Leal
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in SwiftPeter Friese
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologyDaniel Knell
 

Similar to SPFx working with SharePoint data (20)

Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Protocol-Oriented Networking
Protocol-Oriented NetworkingProtocol-Oriented Networking
Protocol-Oriented Networking
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Creating an Uber Clone - Part XXXX.pdf
Creating an Uber Clone - Part XXXX.pdfCreating an Uber Clone - Part XXXX.pdf
Creating an Uber Clone - Part XXXX.pdf
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_service
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
 
Redux vs Alt
Redux vs AltRedux vs Alt
Redux vs Alt
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
React 101
React 101React 101
React 101
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 

More from Vladimir Medina

SPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentSPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentVladimir Medina
 
SharePoint Framework SPFx
SharePoint Framework SPFxSharePoint Framework SPFx
SharePoint Framework SPFxVladimir Medina
 
Meetup Comunidad TESH: My SPFx slides
Meetup Comunidad TESH: My SPFx slidesMeetup Comunidad TESH: My SPFx slides
Meetup Comunidad TESH: My SPFx slidesVladimir Medina
 
Curso SharePoint 2013 overview
Curso SharePoint 2013 overviewCurso SharePoint 2013 overview
Curso SharePoint 2013 overviewVladimir Medina
 
SharePoint en Azure - Global Azure Bootcamp Mexico 2015
SharePoint en Azure - Global Azure Bootcamp Mexico 2015SharePoint en Azure - Global Azure Bootcamp Mexico 2015
SharePoint en Azure - Global Azure Bootcamp Mexico 2015Vladimir Medina
 
SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015
SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015
SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015Vladimir Medina
 

More from Vladimir Medina (7)

SPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentSPFx: Working with SharePoint Content
SPFx: Working with SharePoint Content
 
SharePoint Framework SPFx
SharePoint Framework SPFxSharePoint Framework SPFx
SharePoint Framework SPFx
 
Meetup Comunidad TESH: My SPFx slides
Meetup Comunidad TESH: My SPFx slidesMeetup Comunidad TESH: My SPFx slides
Meetup Comunidad TESH: My SPFx slides
 
Azure + PowerShell
Azure + PowerShellAzure + PowerShell
Azure + PowerShell
 
Curso SharePoint 2013 overview
Curso SharePoint 2013 overviewCurso SharePoint 2013 overview
Curso SharePoint 2013 overview
 
SharePoint en Azure - Global Azure Bootcamp Mexico 2015
SharePoint en Azure - Global Azure Bootcamp Mexico 2015SharePoint en Azure - Global Azure Bootcamp Mexico 2015
SharePoint en Azure - Global Azure Bootcamp Mexico 2015
 
SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015
SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015
SharePoint for SQL DBAs - SQL Saturday Costa Rica 2015
 

Recently uploaded

Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

SPFx working with SharePoint data

  • 1.
  • 3.
  • 4.
  • 5. private _getListItemEntityTypeFullName(context: IWebPartContext):Promise<string> { if (this._listItemEntityTypeFullName){ return Promise.resolve(this._listItemEntityTypeFullName); } return context.spHttpClient.get(context.pageContext["web"]["absoluteUrl"] + `/_api/web/lists/GetByTitle('${this._listName}')`, SPHttpClientConfigurations.v1) .then((response: Response) => { return response.json() }) .then((value) => { this._listItemEntityTypeFullName = value["ListItemEntityTypeFullName"]; return value["ListItemEntityTypeFullName"]; }); }
  • 6. export interface IListItem { Id: number; Title: string; } public getListItems(): Promise<IListItem[]> { return this.context.spHttpClient.get(this.context.pageContext["web"]["absoluteUrl"] + `/_api/web/lists/GetByTitle('${this._listName}')/items?$select=Id,Title`, SPHttpClient.configurations.v1 ) .then((response: Response): Promise<any> => { return response.json(); }) .then((data: any) : IListItem[] =>{ this._showSuccess(`Successfully loaded ${data.value.length} items`); return data.value; }, (error: any): void => { this._showError(`Loading all items failed with error: ${error}`); }) as Promise<IListItem[]>; }
  • 7. const reqJSON: any = JSON.parse( `{ "@odata.type": "${this._listItemEntityTypeFullName}", "Title": "${title}" }`); this.context.spHttpClient.post( this.context.pageContext["web"]["absoluteUrl"] + `/_api/web/lists/GetByTitle('${this._listName}') /items?$expand=ListItemAllFields`, SPHttpClient.configurations.v1, { body: JSON.stringify(reqJSON), headers: { "accept": "application/json", "content-type": "application/json" } } ) .then((response: SPHttpClientResponse): Promise<IListItem> => { return response.json(); })
  • 8. const reqJSON: any = JSON.parse( `{ "@odata.type": "${this._listItemEntityTypeFullName}", "Title": "${title}" }`); this.context.spHttpClient.post( this.context.pageContext["web"]["absoluteUrl"] + `/_api/web/lists/GetByTitle('${this._listName}')/items(${Id})`, SPHttpClient.configurations.v1, { body: JSON.stringify(reqJSON), headers: { "IF-MATCH": "*", "X-HTTP-Method":"MERGE", "accept": "application/json", "content-type": "application/json" } }) .then((response: SPHttpClientResponse): void => { this._showSuccess(`Item with ID: ${Id} successfully updated`); }, (error: any): void => { this._showError(`Error updating item: + ${error}`); });
  • 9. this.context.spHttpClient.post( this.context.pageContext["web"]["absoluteUrl"] + `/_api/web/lists/GetByTitle('${this._listName}')/items(${Id})`, SPHttpClient.configurations.v1, { headers: { "IF-MATCH": "*", "X-HTTP-Method":"DELETE", "accept": "application/json", "content-type": "application/json" } }) .then((response: SPHttpClientResponse): void => { ContainerNode.parentNode.removeChild(ContainerNode); this._showSuccess(`Item with ID: ${Id} successfully deleted`); }, (error: any): void => { this._showError(`Error deleting item: ${error}`); });
  • 10.
  • 11.  Use Office UI Fabric React components  Use state to keep track of Web Part status and data  Use the web part's HttpClient in a React component  Load Angular and ngOfficeUIFabric from CDN  Use conditional rendering for one-time web part setup  Pass web oart configuration to Angular and react to configuration changes in the Angular application  Use the SP PnP JS library with SharePoint Framework Client- Side web parts  Configure global request headers and override them for specific requests, as needed  Sort and select the top n items from a list with the fluent API
  • 12.
  • 13. Code samples and solutions Reusable components Guidance documentation Monthly community calls SharePoint Framework SharePoint add-ins Microsoft Graph Office 365 APIs Sharing is caring… http://aka.ms/SharePointPnP

Editor's Notes

  1. The getListItems method invokes the SharePoint REST API to return the SharePoint lists in the SharePoint site where the web part executes.
  2. Use the Exercise 3: Basic CRUD operations with no framework in the lab manual.