Background

Back in March 2020, Bo George, a Principal Consultant for ThreeWill, wrote the blog post “The Case for a Native SharePoint Questions and Answers Solution” where he discussed the development of an SPFx Solution that can be provisioned in a customer’s environment. Bo described his solution by saying “The SPFx solution allows us to bake in support for a SharePoint Q&A into every new site a user requests, allowing them to turn on and manage support for SharePoint questions and answers from their end-users and moderate them.”

In September, 2020 Bo’s SharePoint Q&A solution was added to the “SharePoint Framework Client-Side Web Part Samples & Tutorial Materials,” which is part of the Microsoft 365 Patterns and Practices (PnP) open-source projects and community samples. Congratulations, Bo!

Specifically, the sample application can be found here at, React Questions and Answers.

It is described as an application that supports a SharePoint Q&A through a web part that can be used directly on a Modern SharePoint Site without the need for Yammer or a backing Microsoft Team site. It relies on a backing SharePoint list that is hidden and a provisioned Site Page that hosts a pre-configured version of the questions web part.

It relies on a backing SharePoint list that is hidden and a provisioned Site Page that hosts a pre-configured version of the questions web part.

Present Day

As part of a current client-facing SharePoint project I am involved in, I wanted to deploy this web part into my SharePoint tenant, as I believe it could satisfy a requirement for a frequently asked questions list.

Deploying the SharePoint Q&A web part

If you are new to SharePoint Framework development, take a look at this article to get started, “Set up your SharePoint Framework development environment.”

Note: A Microsoft 365 tenant is needed … see this article for those details, “Set up your Microsoft 365 tenant.” Further, you can join the Microsoft 365 Developer Program to get access to a Microsoft 365 tenant. For details, see here.

The instructions on the GitHub site provide the details on how to get the application running in your SharePoint instance. Here are some additional notes based on my deployment:

  1. I used “gulp package –production” to create a shippable version of the application … makes later deployment easier
  2. The output from gulp package command is in the local project folder “react-questions-and-answers\sharepoint\solution\react-questions-and-answers.sppkg”
  3. I created an application catalog in my tenant (as opposed to a site collection application catalog), see “Use the App Catalog to make custom business apps available for your SharePoint environment.”
  4. The list data managed by the web part can be found in this hidden list, /Lists/Questions

My Initial Impressions

I liked it! It was easy to create a sample page in my tenant and add the questions web part to the page from the application catalog.

The web part has several configuration options (see the GitHub documentation for details.) I especially like the ability to show only “answered questions” as that is really what a frequently asked questions (FAQ) list is all about. And, if further customization is needed that goes beyond the out-of-the-box configuration options, having access to the source code is great!

Here is a quick listing of the available features:

Questions

  • Search for a Question
  • Show List of Questions by All, Answered or Open
  • View a Question and Replies
  • Ask a Question
  • Edit a Question
  • Delete a question
  • Follow/Unfollow a Question
  • Like/Unlike a Question

Replies

  • Reply to a Question or Reply
  • Edit a Reply
  • Delete a Reply
  • Like/Unlike a Reply
  • Mark/Unmark a Reply as Helpful
  • Mark/Unmark a Reply as Correct Answer

Epilogue – using PnP PowerShell

I ran into an issue using PnP PowerShell that I thought I should share. It has nothing to do with the web part itself. Rather, I am a proponent for scripting tasks that are often repeated, so I installed PnP PowerShell. I wanted to test the automation of the provisioning of the site, including the creation of pages, lists, libraries, web parts, and other SharePoint artifacts. I also plan to use PnP PowerShell to inspect the configuration of the site.

Well, it only took a moment to run into this issue that I want to make you aware of. My initial script was very simple … I wanted to get a list of lists and libraries and the content types installed:

  • Connect-PnPOnline
  • Get-PnPList
  • Get-PnPContentType

All was fine until the “Get-PnPContentType” command threw an exception:

format-default : The collection has not been initialized. It has not been requested or the request has not been

executed. It may need to be explicitly requested.

+ CategoryInfo<span>          </span>: NotSpecified: (:) [format-default], CollectionNotInitializedException

+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.CollectionNotInitializedException,Microsoft. PowerShell.Commands.FormatDefaultCommand

The workaround for me was to pipe the output of the command to Format-Table:

Get-PnPContentType | Sort-Object -Property Name | Format-Table

There are numerous references to this issue … here are a few to review on how to resolve this issue if it happens to you:

Related Content