ObjectOperations.CreateNewAssignment - "Assigned To"

I'm having trouble with the createnewassignment method - I keep hitting an error with the datatype for the "assigned to" property.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<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)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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".'

Fullscreen
1
2
3
4
5
6
7
8
// 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);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Parents
  • I'm not really sure as this looks like a C# code but isnt "assigned to" a multi lookup property? I suppose it should be MFDataType.MFDatatypeMultiLookup

    Your Datatypes are MFDataType.MFDatatypeLookup, MFDataType.MFDatatypeMultiLookup, MFDataType.MFDatatypeText etc..

Reply
  • I'm not really sure as this looks like a C# code but isnt "assigned to" a multi lookup property? I suppose it should be MFDataType.MFDatatypeMultiLookup

    Your Datatypes are MFDataType.MFDatatypeLookup, MFDataType.MFDatatypeMultiLookup, MFDataType.MFDatatypeText etc..

Children
  • Winner! It was indeed the problem of the definition difference between lookup and multilookup - thank you!