Document Library field
Browse and upload files to a SharePoint Document Library, with the folder structure and metadata that brings.
The Document Library field binds the form to a SharePoint document library. The person filling in the form can browse the folder you point them at, open files, upload new ones, and (if you allow it) remove files, all from inside the form. Each file lives as its own document library item with metadata, version history, and permissions inherited from the library.
Files are uploaded when the form is saved, not the moment they are picked: the folder can depend on values in the form, and nothing is left behind in the library if the form is abandoned. Picked files are listed as "Uploads on save" until then.
The folder path shown at the top of the control is a link: click it to open that folder in SharePoint in a new tab, with the library's full toolbar. While you browse a sub-folder, the earlier parts of the path take you back up inside the form, and the last part opens the sub-folder you are in. A per-submission folder that has not been created yet (before the first upload) shows as plain text, since there is nothing in SharePoint to open.
For simple file attachments that travel with the item, use
Attachments instead.
Properties
| Property | Description |
|---|---|
sourceListIdGUID | Source document library GUID. |
sourceListTitlestring | Source library title, cached for the designer UI. |
folderPathstring default: '' (root) | Folder path within the bound library. Empty string = library root. |
showFoldersboolean default: false | Show folder navigation in the runtime widget. |
showFilesboolean default: true | Show files in the runtime widget. |
allowUploadboolean default: true | Allow uploads (vs. browse-only). |
allowDeletionboolean default: false | Allow the filler to delete files they uploaded. |
maxFileSizeMbnumber default: 25 | Cap on per-file upload size in megabytes. Files over 100 MB are uploaded to SharePoint in 10 MB pieces, with progress shown in the saving dialog, so large limits such as 2048 (2 GB) work. |
minFilesnumber | Minimum number of files the filler must upload to submit. |
acceptstring default: '*' | Accepted MIME types for upload, e.g. application/pdf,image/*. |
dynamicFolderboolean default: false | Store files under a folder built from dynamicFolderTemplate rather than the fixed folderPath: one folder per project, per submitter, per year, and so on. |
dynamicFolderTemplatestring | Template for the dynamic-folder path, using the same placeholders as everywhere else: {Field} for a value on the form and [System] for system tokens. See Folder template. |
viewIdGUID | A view on the library. Its columns, sort order and filter are what the grid shows. Blank = the library default view. |
relationColumnInternalNamestring | Show only files related to the current item: a Lookup (or Number) column on the library that holds the host item id. Applied on top of the view filter. Blank = every file in the folder. |
maxFilesnumber | Most files allowed, counting what is already in the folder plus what is picked on this form. |
emptyMessagestring default: 'No files here yet.' | Shown when the target folder has no files. |
internalNamestring | Handle for author JS, as in f365.control('SupportingDocs'). Not a column binding: this control never writes a value to the item. |
heightMode'auto' | 'fixed' default: 'auto' | auto grows to fit; fixed honours heightPx. |
heightPxnumber | Pixel height when heightMode === "fixed". |
Folder template
Turn on Use dynamic folder and each submission files its uploads into its own folder, built from the form's own values. The template uses the same placeholders as the rest of Forms 365, so there is nothing special to learn here:
| You write | You get |
|---|---|
Projects/{Project}/[Today:yyyy] | Projects/Kalgoorlie Depot/2026 |
Requests/Request-[ID] | Requests/Request-812 |
[Me:Title]/[Today:yyyy-MM] | Alec Tecson/2026-08 |
{Field}is a value on the form. A Lookup or Person column gives its title, so{Project}is the lookup's title. Write{Project:Title}if you would rather be explicit.[System]is a system token:[Today:yyyy],[Me:Title],[ID], and the rest of the placeholder vocabulary./nests folders. Paths are relative to the library, so you never type the site URL.- Missing folders are created on the first upload.
A few things worth knowing:
A blank value pauses the upload. If the template needs {Project} and nobody has
picked a project yet, the dropzone is disabled and says which field to fill in. Files are
never quietly dropped into the parent folder or into a folder literally named
{Project}, because you would not find them again.
[ID] waits for the save. A brand-new item has no id until it is saved, so a template
using [ID] accepts the files and files them once the id exists. [ID] is the only token
that works this way. Other values SharePoint fills in on save, such as [GUID] or
[Created], keep the dropzone disabled on a new item, so use [ID] for a per-submission
folder.
Several photos per question. Place one Document Library control next to each question,
all bound to the same library, and give each its own subfolder: [ID]/Front, [ID]/Rear,
[ID]/Damage. Set Accept to image/* and tick Allow multiple files. Each
submission gets one folder named after its id with a subfolder per question, and on the
Edit and Display forms each control lists only its own question's photos. Keep the template
the same on New and Edit: a folder built from [Today] or [Me] would point somewhere else
the next time the item is opened.
Characters SharePoint refuses in a folder name (" * : < > ? / \ |) are replaced with
-, so a value like Acme / Northern becomes one folder called Acme - Northern rather
than two nested ones.
In PDF reports
Photos uploaded through this field print in the form's PDF report as the pictures
themselves. When you generate a report from a form, each Document Library field becomes a
photo section that reads the same folder the field uploads into, using its folder template
(for example [ID]/Photos reads this item's folder only). In the report designer, add
Attachments (photos) and set Files from to the field.
- Photos print in a grid with their file names; other files are listed by name.
- Photos are shrunk before they go into the PDF, so phone photos don't make the emailed report too big. Up to 30 photos print per report.
- If the folder can't be worked out (a
{Field}in the template is empty), the section prints nothing rather than the library's other files. - iPhone HEIC photos print only when the form is submitted from Safari; elsewhere they are listed by name.
JavaScript recipes
Show or hide the library by another field
f365.events.onChange((e) => {
if (e.fieldKey !== 'NeedsDocuments') return;
f365.control('SupportingDocs').visible = Boolean(e.newValue);
});
Toggle the control read-only state
f365.events.onLoad(() => {
// Browse-only once the request has been submitted.
if (f365.field('Status').value === 'Submitted') {
f365.control('SupportingDocs').disabled = true;
}
});
Confirm before submitting without optional docs
f365.events.onBeforeSave(async () => {
// A soft prompt, set `minFiles` in the designer for a hard requirement.
if (f365.field('Category').value === 'Expense Claim') {
const ok = await f365.ui.showConfirm('Submit without attaching a receipt?');
return ok; // false cancels the save
}
return true;
});
Related
Related articles
- Attachments field
Upload files attached to the SharePoint list item, and print attached photos as pictures in the PDF report.
- File upload field
Upload a single file, bound to a column reference, an attachment, or an external storage endpoint.