I am trying to create a new entry into podio via the API I can set text type fields and date type fields but I cannot seem to sort out how to set a category type field. The example for .NET shows setting the OptionId = x where x is a int value of the category field. But what if I do not know that Id value. I have a string value from my DB that matches the text value found in the category (dropdown style) field but not sure I can use that to set it?
This example doesn't work b/c it has no values in option.
var typeCategory_ModuleStr = podioNewItem.Field("module");
IEnumerable<CategoryItemField.Option> categories = typeCategory_ModuleStr.Options;
List<CategoryItemField.Option> moduleOptions = categories.ToList();
foreach (CategoryItemField.Option option in moduleOptions)
{
if (option.Text == tableRow["MODULE"].ToString())
{
typeCategory_ModuleStr.OptionId = Convert.ToInt32(option.Id);
}
}
You can get the matching option with the option text you have by using the below code sample.
then you can set the option like this
C# Client Library Link and Documentation link for any reference.