I'm using the mgt-file-list component from the Microsoft Graph Toolkit and this code works just fine within my application after authentication. It displays a file upload button, and I can upload files into the specified folder. The files are then displayed in a list:
<mgt-file-list id="mgtList" enable-file-upload="true" file-extensions="doc, DOC, docx, DOCX, pdf, png, PNG" max-file-size="10000" max-upload-file="5" insight-type="trending">
</mgt-file-list>
However, when I add in a template to display the files in a custom layout, the file upload button does not work anymore even though I add it back in and it triggers a file selection:
<mgt-file-list id="mgtList" enable-file-upload="true" file-extensions="doc, DOC, docx, DOCX, pdf, png, PNG" max-file-size="10000" max-upload-file="5" insight-type="trending">
<template>
<mgt-file-upload></mgt-file-upload>
<div class="files">
<div data-for="file in files" data-props="{{@click: openFile}}" data-type="file" style="width:100%;display:block;border-bottom:1px solid grey;margin-bottom:15px;">
<h2 alt="{{file.id}}">{{file.name}}</h2>
<h3>{{file.createdDateTime}}</h3>
<h3><a href="{{file.webUrl}}" target="_blank">View File</a></h3>
</div>
</div>
</template>
</mgt-file-list>
My template works fine and properly displays all values, and the link works fine and opens in SharePoint. But I have to recreate now all the functionality of all the elements, and adding back in just "mgt-file-upload" component is not good enough to get the file upload to work. Are there additional attributes I need to add to this component?
Couldn't find any documentation that mentions needing to add in that new file upload component inside the template, I just saw one example that used it somewhere else and guessed I needed it. That element makes the file upload button appear, it asks for a file, you can select, but it then does not upload it. I know it is not an issue with my ability to upload files or authentication because the default no-template works just fine.
Thanks!