Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a Fieldtype as multichoice and set the values? #336

Open
alfredoquintana opened this issue Nov 2, 2023 · 0 comments
Open
Labels

Comments

@alfredoquintana
Copy link

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!

@vgrem vgrem added the question label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants