Adds ability to create files/folders in subfolder using DynamicForm. Closes #1901 #1903
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1901
What's in this Pull Request?
In its current state, a dynamic form always creates new items/files/folders in the root folder of a list or library. This is not very handy when using the dynamic form on document libraries. For example as a custom form to create document sets.
This PR adds the ability to create files, folders and document sets in subfolders.
I've added an extra option to do this. So the user has full control over the folder that should be used. In this way it doesn't matter how the form is rendered. A
RootFolder
querystring parameter may be available that the user can use. (For example in the NewForm of an SPFx FormCustomizer) Or it may not be available. The user is in control of what value he supplies...Testing instructions
To test this feature, you'll need a library where you can create document sets. In
TestForm.tsx
fill in thecontentTypeId
,folderPath
ANDhiddenFields
properties as follows:For the
folderPath
option, you can also use a server relative URL. For example when using the RootFolder querystring of an SPFx form customizer. However: it should be a path to the same library, otherwise the code will fail.FileLeafRef
should be excluded inhiddenFields
, otherwise the form will not submit. This is supposed to be fixed in #1906.