question

LakshmanBana-7513 avatar image
0 Votes"
LakshmanBana-7513 asked LakshmanBana-7513 edited

FieldMultiChoice property update in SPO using CSOM

hello,
using csom api the console app pushed the file content and user defined key value attributes to a folder in sharepoint online. but one of the property is multi choice and i'm facing challenges to set choices in the console app.
any suggestions would be a great help.

  // fci is an object of FileCreationInformation
  File flu = fc.Add(fci);
 // successfully assigned string value properties
 // trying to set multi choice values
 // option 1:
 flu.Properties["MultiChoiceKey"] = new string[] {'O1', 'O2'}; // not working
 // option 2:
 FieldMultiChoice mc = (FieldMultiChoice) flu.Properties["MultiChoiceKey"]; // throws an FieldNotInitialized exception

thanks in advance.
lb

thanks in advance.



dotnet-csharpoffice-sharepoint-online
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BTW it has no problem in setting single value in a multi choice property field.

flu.Properties["MultiChoiceKey"] = "Choice 1";

0 Votes 0 ·
MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered

Hi @LakshmanBana-7513 ;

You could try the below to set multiple choice field;

 flu.ListItemAllFields["MultiChoiceKey"] = new string[] { "A", "B" };
 flu..ListItemAllFields.Update();
 ctx.ExecuteQuery();


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LakshmanBana-7513 avatar image
0 Votes"
LakshmanBana-7513 answered LakshmanBana-7513 edited

I had a space in the key and SPO is embedding "_0x0020_" in place of spaces. Where as in properties the spaces have no issues.
Thanks for your support!
lb

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LakshmanBana-7513 avatar image
0 Votes"
LakshmanBana-7513 answered

It throws an exception: "Column 'MultiChoiceKey' does not exist. It may have been deleted by another user."

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.