Skip to main content

Thoughts, shortcomings, gotchas on SPFx Dynamic Data capabilities

It's the festive break, and I thought I'd try the new Dynamic Data capabilities that recently went to General Availability in SharePoint Framework 1.7.

I've been building a lot of React components lately, and all the SPFx web parts and application customisers with visual elements we create at Engage Squared, are built on React.  Dynamic Data in SPFx introduces a whole new world of modularity that we haven't had before. We can now split up the page elements into multiple web parts that, in the past, have been combined as one web part so state can be passed between them.  Doing this gives control back to the page author, with the ability to position components how they wish.

Breaking components up in to individual web parts also changes the way the components are designed, and forces the developer to leverage the responsive capabilities of modern pages.  Modern pages are designed from the ground up to work on many different screen sizes, and as long as each individual component respects responsive design, we can let the modern page infrastructure do the rest.

SPFx Dynamic Data: Gotcha and Shortcomings

It's somewhat disappointing to note that Dynamic Data in SPFx is not supported on classic pages.  As of the day I published this post, when you introduce a component that calls the
method on a classic page, you get a
Source id contains invalid characters, like "_".
error - or the full exception details as follows:
@VesaJuvonen's comment on this github issue describes this behaviour as "by design". There doesn't seem to be any thing on the roadmap for classic pages to be supported by SPFx's dynamic data capabilities.

With that shortcoming aside, I found adding dynamic data capabilities to be relatively light-weight, and also flexible enough to use in any number of scenarios (more on that later).

One gotcha I discovered that had me tearing my hair out for a good day or two (in between festive partying, dinner, drinking, and pudding) was when I encountered the following
Serialization failed for web part WebPart.DynamicDataConsumerWebPart.3c797b3b-6634-404c-8772-d09a49f94236

Don't panic.

This happens when dynamic data properties are added to a web part's propertiesMetadata() readonly call, and have not been added to the properties node of the web part's *.manifest.json file. When your *WebPart.ts file has propertiesMetadata() like this:
... the web part's manifest file should include "dyanmicProperty0" in the "properties" node: After adding them to your web part's .manifest.json file, you will need to redeploy the app's sppkg file to the app catalog, and you will also need to remove and re-add the web part to the page you're working on.

This is a departure from the implementation of other web part properties types. SPFx web part properties have not been required in the .manifest.json file in the past.  I was wondering if the product team will consider this inconsistency to be a bug, so I raised this issue in the sp-dev-docs repo, found here.


Popular posts from this blog

Apps for SharePoint 2013 - Client and Server-side code

It's about time I blew the dust off this blog. Tonight I did a presentation at the Melbourne SharePoint User Group entitled Apps For SharePoint (2013). It included two demos based on the App For SharePoint 2013 solution template in Visual Studio 2012.

The two demos illustrated how you can create a separate ASP.Net Web Application. Demo 1 showed how easy it is to hook in to SharePoint to obtain List properties via server-side code (populating an ASP.Net Repeater Control). Demo 2 showed what you can do with SharePoint 2013's Javascript hooks. Specifically, using SP.UI.Controls.js from the /_layouts/15/ SharePoint folder to pull chrome elements out of SharePoint, and render them in your ASP.Net web app.

No animals were harmed in the making of these demos, but a few articles kindly provided on the Microsoft MSDN site helped put it together:
How to: Set up an on-premises development environment for apps for SharePointHow to: Create high-trust apps for SharePoint 2013 using the se…

SharePoint User Profiles and Properties error

I recently encountered an issue with the Shared Services Administration page for User Profile and Properties (the page where you schedule an Active Directory profile import).

The page in question is in the Shared Services Provider site, e.g. http://server:port/ssp/admin/_layouts/ProfMain.aspx

The error that gets displayed is:
An error has occurred while accessing the SQL Server database or the Office SharePoint Server Search service. If this is the first time you have seen this message, try again later. If this problem persists, contact your administrator.

The error was odd, because I knew SharePoint Search was functioning (search crawls were running as normal, and search queries were being filled in the web front end). After a bit of investigation, I found the following table to be missing some records that were required.

So in actual fact, the error being referred to when accessing the SQL Server database was that some expected records weren't in the table being looked up, not that …