phpSPO
phpSPO copied to clipboard
How to create a Fieldtype as multichoice and set the values?
Hi i am trying to create a multichoice metadata type and set the values. i have tried to use the FieldCreationInformation.
$metadataName = 'new metadata'; $library = $this->credentials->getWeb()->getLists()->getByTitle($dir); $array[] = ['value1', 'value2', 'value3'];
` $fieldCreationInformation = new FieldCreationInformation();
$fieldCreationInformation->Title = $metadataName;
$fieldCreationInformation->Choices = $array;
$fieldCreationInformation->FieldTypeKind = FieldType::MultiChoice;
$metadataField = $library->getFields()->add($fieldCreationInformation);`
and have this error
{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-EN","value":" Property 'Choices' does not exist on type 'SP.Field'. Make sure you only use property names that are defined by the type."}}}
thank you very much, have a nice day!