I'm having trouble with the createnewassignment method - I keep hitting an error with the datatype for the "assigned to" property.
<MetadataEditor>, -, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) ScriptErrorHelper.cpp, 96, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MDispatchExImpl.h, 679, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MDispatchExImpl.h, 841, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MetadataCardAction.cpp, 386, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MetadataCardAction.cpp, 560, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MetadataEditor.cpp, 2972, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MetadataModel.cpp, 4540, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MetadataModel.cpp, 4991, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) ElectronicSignatureUIHelper.cpp, 239, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MetadataModel.cpp, 12770, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) CoVaultMountingDocumentOperations.cpp, 3333, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) CoVaultMountingDocumentOperations.cpp, 3421, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) DocumentCache.cpp, 11970, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) DocumentCache.cpp, 12081, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) DocumentCache.cpp, 20518, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) IRPCObjectOperations.generated.cpp, 18362, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) gRPCClient.cpp, 497, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) gRPCClient.cpp, 466, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) gRPCClient.cpp, 99, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) gRPC.generated.cpp, 19710, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperations.cpp, 7427, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) MCallInLoop.h, 535, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelper.cpp, 4590, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelper.cpp, 4073, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelper.cpp, 9764, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelper.cpp, 10551, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelper.cpp, 26320, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelperPrivate.cpp, 2990, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelperPrivate.cpp, 3207, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelperPrivate.cpp, 3640, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) RPCDocumentOperationsHelperPrivate.cpp, 4527, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) VaultScriptSessionTemplates.cpp, 280, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) VaultScriptSessionTemplates.cpp, 381, Script execution failed. ((Approved, StateAction: 24940-30)) (0x800408BB) VaultScriptSessionTemplates.cpp, 381, Wrong data type for property definition "Assigned to". (0x8004009A) VaultScriptSessionTemplates.cpp, 627, Wrong data type for property definition "Assigned to". (0x8004009A) CoActiveScriptSite.cpp, 914, Wrong data type for property definition "Assigned to". (0x8004009A) CoActiveScriptSite.cpp, 744, Wrong data type for property definition "Assigned to". (0x8004009A) Approved, StateAction, 23, Wrong data type for property definition "Assigned to". (0x8004009A) CoDynamicCLRObjectWrapper.cpp, 561, Wrong data type for property definition "Assigned to". (0x8004009A) CoDynamicCLRObjectWrapper.cpp, 332, Wrong data type for property definition "Assigned to". (0x8004009A) ManagedError.cpp, 152, Wrong data type for property definition "Assigned to". (0x8004009A) DocumentWorkflow 1.1: [Void RunStateAction(MFiles.VAF.ScriptEnvironment)], IL:162, Wrong data type for property definition "Assigned to". (0x8004009A) DocumentWorkflow 1.1: [Boolean RunAction(MFiles.VAF.Common.StateEnvironment, MFiles.VAF.IExecutionTrace)], IL:457, Wrong data type for property definition "Assigned to". (0x8004009A) VaultApplication.cs, 359 (IL:437), Wrong data type for property definition "Assigned to". (0x8004009A) DocumentWorkflow 1.1: [MFilesAPI.ObjectVersionAndProperties CreateNewAssignment(System.String, System.String, MFilesAPI.TypedValue, MFilesAPI.TypedValue, MFilesAPI.AccessControlList)], IL:-1, Wrong data type for property definition "Assigned to". (0x8004009A) CoVaultObjectOperations.cpp, 4747, Wrong data type for property definition "Assigned to". (0x8004009A) ServerVaultObjectOperationsHelper.cpp, 1130, Wrong data type for property definition "Assigned to". (0x8004009A) ServerVaultObjectOperationsHelper.cpp, 1377, Wrong data type for property definition "Assigned to". (0x8004009A) RPCObjectOperationsHelper.cpp, 485, Wrong data type for property definition "Assigned to". (0x8004009A) CoRPCOverCOM.cpp, 6729, Wrong data type for property definition "Assigned to". (0x8004009A) RPCDocumentOperations.cpp, 5554, Wrong data type for property definition "Assigned to". (0x8004009A) MCallInLoop.h, 535, Wrong data type for property definition "Assigned to". (0x8004009A) RPCDocumentOperationsHelper.cpp, 249, Wrong data type for property definition "Assigned to". (0x8004009A) RPCDocumentOperationsHelper.cpp, 317, Wrong data type for property definition "Assigned to". (0x8004009A) RPCDocumentOperationsHelperPrivate.cpp, 9364, Wrong data type for property definition "Assigned to". (0x8004009A) RPCDocumentOperationsHelperPrivate.cpp, 10125, Wrong data type for property definition "Assigned to". (0x8004009A) (M-Files 25.1.14445.5 2025-02-05T02:55:44.114Z)
I've tried to work out the property I should be using, but the documentation is fairly incomplete for this part of the API. The assumption that I made was that this was looking for the M-Files user ID.
The datatype required is "TypedValue", and I've tried to satisfy this with the code below but I'm getting the following error 'Wrong data type for property definition "Assigned to".'
// get the M-Files User of the author var authorMFUser = authorProperties.SearchForProperty(MfilesUserProperty).TypedValue.Value; TypedValue authorMFUserTyped = new TypedValue(); authorMFUserTyped.SetValue(MFDataType.MFDatatypeLookup, authorMFUser); env.Vault.ObjectOperations.CreateNewAssignment("Title", "Transmittal text.", authorMFUserTyped);