Category Archives: TypeScript

How to Save a MultiPerson PeoplePicker to a SharePoint List

In a recent project where I was building a SPFx webpart using React Hooks, Typescript, Fluent UI and PNPjs, I found myself struggling to save a multiperson peoplepicker to a SharePoint list. The biggest difficulty I was having was the fact that I needed to make a call to ensureUser to retrieve a user id for each person selected in the peoplepicker before I could save the group of users to the SharePoint list.

Read more

Cascading Observables

Mike BerrymanIn my Observables in Parallel blog post I discussed how I’ve been moving away from Promises in favor of Observables and how to translate functionality from promise-based solutions to observable-based solutions.  The aforementioned blog post discussed how to wait for multiple Observables to complete before performing some action.  In that scenario all the Observables were independent of each other, meaning none of the Observables depended on the results of another.

In this blog post I’m going to discuss how to use Observables that do depend on a different Observable to complete before executing – AKA Cascading Observables.  One such use case scenario for Cascading Observables is when you need to call a web service to get some data, then use that data to call another web service, all in a single operation.

Read more

Observables in Parallel

Mike BerrymanSince observables are being heavily pushed in Angular 2 I’ve been spending some time getting acquainted with how to use them.  Specifically I’ve been “translating” from a promise-based solution to an observable-based solution for certain functionality I’ve been using promises for.  In this blog post I’m going to address how to utilize observables in parallel.

When I say “observables in parallel”, what I mean is multiple observables that are called all at once with the calling code waiting for all the observables to complete their respective actions before continuing.  With promises you could create an array of promises, then utilize the Promise.all() function to wait until all the promises have completed before moving on.  Each individual promise would utilize the .then() function to do whatever needs to be done with that promises’s results.

Read more

« Older Entries