The parameter is incorrect. InnerException

Hey, 

We are building a web application and we are passing data and documents to M-Files using M-Files web services. 

When we are uploading a number of documents (5-6 documents) collectively, not individually, we get the below error. 

For other cases same call is successfull. 

We are making the below call : 

“REST/objects/0” 

With the below body request : 

{ "PropertyValues": [ { "PropertyDef": 100, "TypedValue": { "DataType": 9, "HasValue": false, "Value": null, "Lookup": { "Deleted": false, "DisplayValue": null, "Hidden": false, "Item": 111, "Version": -1 }, "Lookups": null, "DisplayValue": null, "SortingKey": null, "SerializedValue": null } }, { "PropertyDef": 0, "TypedValue": { "DataType": 1, "HasValue": false, "Value": "Individual Details Documents - Test", "Lookup": null, "Lookups": null, "DisplayValue": null, "SortingKey": null, "SerializedValue": null } }, { "PropertyDef": 1317, "TypedValue": { "DataType": 10, "HasValue": false, "Value": null, "Lookup": null, "Lookups": [ { "Deleted": false, "DisplayValue": null, "Hidden": false, "Item": 174, "Version": -1 } ], "DisplayValue": null, "SortingKey": null, "SerializedValue": null } }, { "PropertyDef": 1036, "TypedValue": { "DataType": 5, "HasValue": false, "Value": "2023-12-11T11:05:53.0839986+02:00", "Lookup": null, "Lookups": null, "DisplayValue": null, "SortingKey": null, "SerializedValue": null } }, { "PropertyDef": 1249, "TypedValue": { "DataType": 5, "HasValue": false, "Value": "2024-12-11T11:05:53.0840059+02:00", "Lookup": null, "Lookups": null, "DisplayValue": null, "SortingKey": null, "SerializedValue": null } } ], "Files": [ { "UploadID": 49, "Title": "AccountOpenningIssueLog 01122023", "Extension": "xlsx", "Size": 163177, "FileInformationType": 0, "TempFilePath": null, "Status": 0, "URL": null, "Method": null, "Exception": null, "Stack": null, "Message": null, "IsLoggedToVault": false, "IsLoggedToApplication": false, "ExceptionName": null }, { "UploadID": 50, "Title": "ImplementationMethodologyProcess 1", "Extension": "png", "Size": 146352, "FileInformationType": 0, "TempFilePath": null, "Status": 0, "URL": null, "Method": null, "Exception": null, "Stack": null, "Message": null, "IsLoggedToVault": false, "IsLoggedToApplication": false, "ExceptionName": null }, { "UploadID": 51, "Title": "AccountOpenningIssueLog f1", "Extension": "xlsx", "Size": 19145, "FileInformationType": 0, "TempFilePath": null, "Status": 0, "URL": null, "Method": null, "Exception": null, "Stack": null, "Message": null, "IsLoggedToVault": false, "IsLoggedToApplication": false, "ExceptionName": null }, { "UploadID": 52, "Title": "AccountOpenningIssueLog 17112023", "Extension": "xlsx", "Size": 162373, "FileInformationType": 0, "TempFilePath": null, "Status": 0, "URL": null, "Method": null, "Exception": null, "Stack": null, "Message": null, "IsLoggedToVault": false, "IsLoggedToApplication": false, "ExceptionName": null }, { "UploadID": 53, "Title": "signature", "Extension": "jpg", "Size": 1398, "FileInformationType": 0, "TempFilePath": null, "Status": 0, "URL": null, "Method": null, "Exception": null, "Stack": null, "Message": null, "IsLoggedToVault": false, "IsLoggedToApplication": false, "ExceptionName": null }, { "UploadID": 54, "Title": "ImplementationApproach 1", "Extension": "png", "Size": 333497, "FileInformationType": 0, "TempFilePath": null, "Status": 0, "URL": null, "Method": null, "Exception": null, "Stack": null, "Message": null, "IsLoggedToVault": false, "IsLoggedToApplication": false, "ExceptionName": null } ] }

And we get the below error response: 

{"ErrorCode":"196695","Status":400,"URL":"/objects/0","Method":"POST","Exception":{"Name":"COMException","Message":"The parameter is incorrect.","InnerException":{"Name":"MFilesException","Message":"The parameter is incorrect.","StackText":"Error reference ID: 9da7e71e-9837-4176-a627-e1b80c7739e0","ErrorCode":"196695"}},"Stack":"Error reference ID: 9da7e71e-9837-4176-a627-e1b80c7739e0","Message":"The parameter is incorrect.","IsLoggedToVault":true,"IsLoggedToApplication":true,"ExceptionName":"COMException"}

  • It looks like you're not including property 22 ("single file object").  If you want to create a multi-file document then you need to include that property and set it to false.

    Edit: your "upload" objects also have lots of additional properties.  Only the properties listed here are needed.

  • Still after include property 22 get the same error. Might be the "extra" properties? : 

    {
        "PropertyValues": [
          {
            "PropertyDef": 100,
            "TypedValue": {
              "DataType": 9,
              "HasValue": false,
              "Value": null,
              "Lookup": {
                "Deleted": false,
                "DisplayValue": null,
                "Hidden": false,
                "Item": 111,
                "Version": -1
              },
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          },
          {
            "PropertyDef": 0,
            "TypedValue": {
              "DataType": 1,
              "HasValue": false,
              "Value": "Individual Details Documents - Test",
              "Lookup": null,
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          },
          {
            "PropertyDef": 1317,
            "TypedValue": {
              "DataType": 10,
              "HasValue": false,
              "Value": null,
              "Lookup": null,
              "Lookups": [
                {
                  "Deleted": false,
                  "DisplayValue": null,
                  "Hidden": false,
                  "Item": 176,
                  "Version": -1
                }
              ],
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          },
          {
            "PropertyDef": 1036,
            "TypedValue": {
              "DataType": 5,
              "HasValue": false,
              "Value": "2023-12-11T16:46:43.6253481+02:00",
              "Lookup": null,
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          },
          {
            "PropertyDef": 1249,
            "TypedValue": {
              "DataType": 5,
              "HasValue": false,
              "Value": "2024-12-11T16:46:43.6253736+02:00",
              "Lookup": null,
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          },
          {
            "PropertyDef": 22,
            "TypedValue": {
              "DataType": 8,
              "HasValue": false,
              "Value": false,
              "Lookup": null,
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          }
        ],
        "Files": [
          {
            "UploadID": 87,
            "Title": "AccountOpenningIssueLog 01122023",
            "Extension": "xlsx",
            "Size": 163177,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          },
          {
            "UploadID": 88,
            "Title": "ImplementationMethodologyProcess 1",
            "Extension": "png",
            "Size": 146352,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          },
          {
            "UploadID": 89,
            "Title": "AccountOpenningIssueLog f1",
            "Extension": "xlsx",
            "Size": 19145,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          },
          {
            "UploadID": 90,
            "Title": "AccountOpenningIssueLog 17112023",
            "Extension": "xlsx",
            "Size": 162373,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          },
          {
            "UploadID": 91,
            "Title": "signature",
            "Extension": "jpg",
            "Size": 1398,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          },
          {
            "UploadID": 92,
            "Title": "ImplementationApproach 1",
            "Extension": "png",
            "Size": 333497,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          }
        ]
      }

  • It shouldn't be the extra properties.  I can see some oddities in your JSON (e.g. the properties say they don't have a value, but they do), but let me test it here quickly first...

  • I just took out some of the property values that you're setting (as I don't have them), changed a couple of properties (e.g. the class), and removed a couple of the uploads, but the below worked for me:

    {
        "PropertyValues": [
          {
            "PropertyDef": 100,
            "TypedValue": {
              "DataType": 9,
              "HasValue": false,
              "Value": null,
              "Lookup": {
                "Deleted": false,
                "DisplayValue": null,
                "Hidden": false,
                "Item": 0,
                "Version": -1
              },
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          },
          {
            "PropertyDef": 0,
            "TypedValue": {
              "DataType": 1,
              "HasValue": false,
              "Value": "Individual Details Documents - Test",
              "Lookup": null,
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          },
          {
            "PropertyDef": 22,
            "TypedValue": {
              "DataType": 8,
              "HasValue": false,
              "Value": false,
              "Lookup": null,
              "Lookups": null,
              "DisplayValue": null,
              "SortingKey": null,
              "SerializedValue": null
            }
          }
        ],
        "Files": [
          {
            "UploadID": 3,
            "Title": "AccountOpenningIssueLog 01122023",
            "Extension": "xlsx",
            "Size": 0,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          },
          {
            "UploadID": 4,
            "Title": "AccountOpenningIssueLog asdasd",
            "Extension": "xlsx",
            "Size": 0,
            "FileInformationType": 0,
            "TempFilePath": null,
            "Status": 0,
            "URL": null,
            "Method": null,
            "Exception": null,
            "Stack": null,
            "Message": null,
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": null
          }
        ]
      }

    I'd take out the "HasValue" properties for each (they're incorrect), and double-check all the data types and IDs.  I don't see anything inherently wrong though.

  • Hey Craig,

    Looks like I was trying to upload documents to a wrong non-document class. Corrected the ID and everything works fine. 

    Thank you