question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PropertyFieldFilePicker not working in Viva ACE Property Panes

See original GitHub issue

Category

[ ] Enhancement

[ x] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 3.2.0 ]

Expected Behaviour

Expected the control to work when implemented with a Viva Adaptive Card

Observed Behaviour

When implementing the control, I initially sort of got it working inside the separate Property Control Pane file that comes scaffolded with the Adaptive Card generated in yeoman. However, since it couldn’t obtain the correct web part context in the separate file, my colleague and I tried migrating it to the main .ts file where the render function lives. This worked fine with the other controls I had implemented (some custom filtering functions that use PropertyPaneTextField to take in a query string) but as soon as I tried to add in the File Picker, I suddenly received an entry point error telling me that the module “PropertyControlStrings” couldn’t be found. After pairing with a more experienced dev we were unable to find a way to resolve the issue.

Steps to Reproduce

  • Clone the repo HERE
  • In the project repo, run npm install
  • Implement the file picker as shown in the docs OR migrate the property pane into the HelloWorldAdaptivecardExtension.ts file and then attempt to implement the file picker as per docs. Both methods have caused the issue for me.

Thank you so much for your help and apologies if I’m doing something stupid - I’m only a junior and struggling with developing Viva ACEs

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
msftbot[bot]commented, Nov 10, 2021

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

0reactions
AJIXuMuKcommented, Dec 18, 2021

Hi @Theosaurus-Rex - what exactly doesn’t work for you? I don’t see any issues: Screen Shot 2021-12-18 at 12 43 12 PM

I took your example, installed property controls in there. This is the code for property pane:

import { IPropertyPaneConfiguration, PropertyPaneTextField, PropertyPaneDropdown } from '@microsoft/sp-property-pane';
import * as strings from 'HelloWorldAdaptiveCardExtensionStrings';
import { IHelloWorldAdaptiveCardExtensionProps } from './HelloWorldAdaptiveCardExtension';
import { PropertyFieldFilePicker, IPropertyFieldFilePickerProps, IFilePickerResult } from "@pnp/spfx-property-controls/lib/PropertyFieldFilePicker";
import { BaseComponentContext } from '@microsoft/sp-component-base';

export class HelloWorldPropertyPane {
  public getPropertyPaneConfiguration(properties: IHelloWorldAdaptiveCardExtensionProps,
    context: BaseComponentContext,
    onPropertyPaneFieldChanged: () => void): IPropertyPaneConfiguration {
    return {
      pages: [
        {
          header: {
            description: 'Card Settings'
          },
          groups: [
            {
              groupName: "Filters",
              groupFields: [
                PropertyPaneTextField('filterBySenderEmail', {
                  label: 'Filter by Sender',
                }),
                PropertyPaneTextField('filterBySubject', {
                  label: 'Filter by Subject'
                }),
                PropertyFieldFilePicker('filePicker', {
                  context: context as any,
                  filePickerResult: properties.filePickerResult,
                  onPropertyChange: onPropertyPaneFieldChanged,
                  properties: properties,
                  onSave: (e: IFilePickerResult) => { console.log(e); properties.filePickerResult = e; },
                  onChanged: (e: IFilePickerResult) => { console.log(e); properties.filePickerResult = e; },
                  key: "filePickerId",
                  buttonLabel: "File Picker",
                  label: "File Picker",
                })
              ]
            }
          ]
        }
      ]
    };
  }
}

And here is how it’s called:

protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
    return this._deferredPropertyPane!.getPropertyPaneConfiguration(this.properties, this.context, this.onPropertyPaneFieldChanged);
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Preview for picked file updates across all instances ... - GitHub
I expect that when I have multiple File Picker web parts in my property pane, both with unique identifying keys, that the preview...
Read more >
PropertyFieldFilePicker - @pnp/spfx-property-controls
PropertyFieldFilePicker control¶. File picker control allows to browse and select a file from various places via the property pane.
Read more >
Enabling any control to be used in the SPFx property pane ...
Push child (control) to container ( Property pane ). This PnP Community demo is taken from the Viva Connections & SharePoint Framework ...
Read more >
Working with the Web Part Property Pane - YouTube
This module will introduce you to leveraging the property pane for client-side web parts. You can use the property pane to configure and ......
Read more >
State of SharePoint Client-Side Dev - Winter (Q1) 2022
In this post I'll give you an update on where we are with popular frameworks and tools developers use in the client-side SharePoint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found