CreateDocumentWithAttachment
Interface Function
Upload attachment and create Document, and execute workflow through assignment of ActionCode.
Request Parameter
Parameter | Type | Remarks |
---|---|---|
FormAlias | String | Form alias, the identity of the form |
DataId | String | Document ID, GUID without underscore, can be empty, automatically generated when the interface is empty, Create a new Document, if the Document exists when it is not empty, update the Document, otherwise create a new Document. |
UserName | String | When creating, the creator/modifier, and when modifying, it is the modifier. If UserName is incorrect, but ActionCode is set, Workflow Action cannot be executed correctly |
UserId | String | Staff Code, when creating a new creation, assign a value to the attribute of the creator, and assign a value to the attribute of the modifier when modifying. If the parameter is incorrect, but the ActionCode is set, the Workflow Action cannot be executed correctly |
AttachmentFieldName | String | The corresponding control Field name of the attachment in the Form |
TransferToPDF | Bool | Whether to convert the attachment to PDF, the default is true.4.5.1start support. This field forces false if the attachment control is a secure upload control. |
ActionCode | String | ActionCode of Workflow button |
ActionMessage | String | Document history information, which can be displayed in the Edit History component |
Data | Dictionary<string, object> |
Attachment information. See the below table for detailed fields. |
DocumentData | Dictionary<string, string> |
A dictionary of other fields in the document. This parameter is required. If there is no field to be updated, you can pass in {}. See the table below for specific fields. |
Data Description
Field Name | Type | Remarks |
---|---|---|
fileName | string | File name |
fileStream | Stream | File byte stream |
fileUUID | string | File identification, you can specify GUID (with-long format) as the value, if not specified, the interface is automatically generated. You can call DownloadAttachment to download attachments through this field. |
totalSize | long | File size |
Return Data Type
Data type is string when operation fails, 1 is for success, and other values are for failure.
Return data type when all operations are completed:
UploadAttachmentResult
.
Field Name | string | Remarks |
---|---|---|
StatusCode | string | Return status code |
info | string | API execution result description. |
entityName | string | Form alias, the identity of the form |
dataId | string | Document ID |
result | string | Operation result |
msg | string | Operation result description |
Note
The attachment types that can be converted to PDF are: "JPG","BMP","PNG","GIF","PPTX","PPT","XLSX","XLS","DOCX","DOC"," VSDX","VSD","PDF".
The attachment types that can be converted to HTML are: "PPTX","PPT","XLSX","XLS","DOCX","DOC","PDF","CSV","JPG","JPEG","PNG".
The system will judge the type of the corresponding control according to the specified AttachmentFiledName, and automatically process the logic of converting to html. Also note: Converting to HTML and PDF are mutually exclusive.
When the TransferToPDF parameter is set to "true", the interface will judge the attachment format type. If the attachment format is a type supported by the system, a PDF preview file will be automatically generated and saved after uploading, otherwise an error message will be returned.
When the TransferToPDF parameter is set to "false", the interface does not check the attachment format type and does not generate a PDF preview file.
This method does not support fragment upload.
Input Sample
{
"FormAlias": "DemoFormAlias",
//If not specified, the interface is automatically generated.
"DataId": "94635f2b5ae24fa28d6ca3ab5c96f8c9",
"UserName": "DemoUser",
"UserId": "420e8692-814b-491a-96c3-af63ea2a3ec1",
//Can be empty when the workflow is not executed
"ActionCode": "",
"ActionMessage": "BulkUploadLog",
//The name of the field to which the attachment belongs
"AttachmentFieldName": "Log",
//file info
"Data": {
"fileName": "newfile.txt",
//DownloadAttachment can be downloaded by the value of this field
"fileUUID": "3707425b-8a65-44c9-8627-ebbc0d2e622f",
"totalSize": 18,
//it is MemoryStream to Base64 string
"fileStream": "dGhpcyBpcyBkdWEgdGVzdCAx"
},
"DocumentData": {
"OtherField": "demo"
}
}
Return Sample
{
"StatusCode": 200,
"Info": "Request (or process) succeeded",
"Data": {
"entityName": "DemoFormAlias",
"dataId": "94635f2b5ae24fa28d6ca3ab5c96f8c9",
"result": 1,
"msg": "Process successed"
}
}