passing choice column additionalAttributes in AddFieldAsXml

%3CLINGO-SUB%20id%3D%22lingo-sub-165829%22%20slang%3D%22en-US%22%3Epassing%20choice%20column%20additionalAttributes%20in%20AddFieldAsXml%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-165829%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20using%20a%20PnP%20solution%20to%20create%20a%20custom%20solution%20from%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2FPnP%2Ftree%2Fmaster%2FSamples%2FProvisioning.ReR%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSharePoint%2FPnP%2Ftree%2Fmaster%2FSamples%2FProvisioning.ReR%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20method%26nbsp%3BAddFieldAsXml%20takes%20somes%20parameters%3C%2FP%3E%0A%3CP%3EIf%20i%20want%20to%20pass%20a%20choice%20column%20then%20how%20we%20go%20about%20puttingthe%20choices.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAddFieldAsXml(requestList%2C%20SiteRequestFields.StateML%2C%20SiteRequestFields.cmdMultipleDisplayName%2C%20SiteRequestFields.cmdMultipleDisplayId%2C%20%22Choice%22%2C%20%22Format%3D'Dropdown'%20Xml%3D'%3CCHOICES%3E%3CCHOICE%3ETest1%3C%2FCHOICE%3E%3CCHOICE%3ETest2%3C%2FCHOICE%3E%3CCHOICE%3ETest3%3C%2FCHOICE%3E%3C%2FCHOICES%3E'%22)%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%20the%20above%20code%20did%20not%20work.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-165829%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Regular Contributor

I am using a PnP solution to create a custom solution from

https://github.com/SharePoint/PnP/tree/master/Samples/Provisioning.ReR

 

The method AddFieldAsXml takes somes parameters

If i want to pass a choice column then how we go about puttingthe choices.

 

AddFieldAsXml(requestList, SiteRequestFields.StateML, SiteRequestFields.cmdMultipleDisplayName, SiteRequestFields.cmdMultipleDisplayId, "Choice", "Format='Dropdown' Xml='<Choices><Choice>Test1</Choice><Choice>Test2</Choice><Choice>Test3</Choice></Choices>'");

 

However the above code did not work.

 

Thanks

1 Reply
Highlighted

Per link below, choice XML elements should be all caps (XML is case sensitive).  I haven't tested this yet though.

 

https://sharepoint.stackexchange.com/questions/199454/create-choice-column-in-sharepoint-list