10-10-2019 01:30 PM
I am trying to add a value when indexing a document through the API using StoreNewDocumentProperties.AddKeyword(string keyword, string value), but I keep getting an error that it cannot store a null value. The keyword is multi-instance and part of a Keyword Type Group with the same name. All other keywords are storing correctly. If I omit this one, is there a special way to handle these and if so, can someone help me out?
10-11-2019 03:40 AM
Yes, There is a special way because the keyword is part of a keyword type group. Bottom line is that you need to create an editable keyword record type (KRT) object then add keyword(s) to the KRT.
Here is a previous answer with more complete pseudocode you need to do what you asked for.
Add Multi Instance Keyword Records through API
Cheers.
10-11-2019 04:42 AM
Hi Ryan,
I am agree with Shane's answer, you need to create EditableKeywordRecord for multi instance record type. Use below code if it can help you.
KeywordModifier keymode = Doc.CreateKeywordModifier(); if (keyRec.KeywordRecordType.RecordType != RecordType.MultiInstance) { keymode.AddKeyword(keyword type, keyword value); }else { EditableKeywordRecord editKeyRec = keyRec.CreateEditableKeywordRecord(); editKeyRec.AddKeyword(keyword type, keyword value); keymode.UpdateKeywordRecord(editKeyRec); }keymode.ApplyChanges();
Regards,
Amir
10-11-2019 03:40 AM
Yes, There is a special way because the keyword is part of a keyword type group. Bottom line is that you need to create an editable keyword record type (KRT) object then add keyword(s) to the KRT.
Here is a previous answer with more complete pseudocode you need to do what you asked for.
Add Multi Instance Keyword Records through API
Cheers.
10-11-2019 04:42 AM
Hi Ryan,
I am agree with Shane's answer, you need to create EditableKeywordRecord for multi instance record type. Use below code if it can help you.
KeywordModifier keymode = Doc.CreateKeywordModifier(); if (keyRec.KeywordRecordType.RecordType != RecordType.MultiInstance) { keymode.AddKeyword(keyword type, keyword value); }else { EditableKeywordRecord editKeyRec = keyRec.CreateEditableKeywordRecord(); editKeyRec.AddKeyword(keyword type, keyword value); keymode.UpdateKeywordRecord(editKeyRec); }keymode.ApplyChanges();
Regards,
Amir
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.