How to load a file into 'file explorer' using a new file menu item


I am trying to import a file with a newly added file menu item. I am able to add a new menu item under ‘File’. I have also added logic to open the file upload dialog. But when I select a file and click ‘Open’, it doesn’t load that file into the file explorer. Can any one let me know what I am missing?

Here is the code I used for opening the dialog.

protected async openDialog() {
        // The open dialog customizable properties.
        const props: OpenFileDialogProps = {
            title: '********',
            canSelectFolders: true,
            canSelectFiles: true,
        // Get the first workspace root.
        const root = this.workspaceService.tryGetRoots()[0];
        // Open the `Open Dialog` with the given properties, and with respect to the given root.
        const fileURI = await this.fileDialogService.showOpenDialog(props, root);
        if (fileURI) {

            /*Handle the logic */


Your logic should take care of importing the file to the file-system. Nothing more. The framework and the Navigator will take care of the rest.

/*Handle the logic */
It should be something like:

fileService: FileService;

handle(): Promise<void> {
  await this.fileService.copy(uriToYourFileToImport, theDestinationUri);
1 Like