Keywords adding into Doc Def

Question

How would the method for adding new Keywords to the KeywordList Object of the Purchase Order Labels look like?

 

Answer

project.DocumentDefinitions.CheckOut(documentDefinition);
IInvoiceLanguages invoiceLanguages = documentDefinition.InvoiceSettings.InvoiceLanguages;

foreach (IInvoiceLanguage invoiceLanguage in invoiceLanguages) {
	if (invoiceLanguage.Name == "English") {
		IKeywordLists keywordLists = invoiceLanguage.KeywordLists;
		foreach (IKeywordList keywordList in keywordLists) {
			if(keywordList.Name == "OrderNumberLabels") {
				keywordList.Keywords = keywordList.Keywords + "|myOrderNumber";
			}
		}
	}
}

documentDefinition.Check();
project.DocumentDefinitions.CheckIn(documentDefinition);

Before running the code, please make sure the "Purchase order matching" feature is enabled, otherwise it'll cause an IPE.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.