Create a file
You can create a file in OneDrive from a solution in the Jigx App. Use the media-field component in a form to upload a file or image, then use the OneDrive Data Provider, its create method. and required properties for successful file creation.
Properties
The following properties are required in the YAML:
file- reference the physical filefileName- add the file name with the extension, e.g. Invoice.pdfentity- file path in OneDrivetokenType- OAuth token credentials namemethod: create
Component
To create a file use the media-field component to select the file. Use the image, or any property in the media-field component to specify the mediaType.
Considerations
The create method does not allow you to create a file with a filename that already exists and an error will occur. To ensure the cause of the error is understood Jigx recommends you build in logic using a
modalto show a message that the filename is already in use.A new file is created even when an
idis specified.Using the
method: savewill create a new file if the filename does not exist, otherwise the save will function as an update method.A delay or time lag of several minutes could be experienced when files are syncing between the device and OneDrive.
Code example
The code below provides an example for creating an invoice in the myfiles directory of OneDrive.
Example of a modal message that can be displayed when creating a file with an existing file name. The full code snippet is shown:
See also
Last updated
Was this helpful?