Tuesday, 24 September 2013

Provisioning MutliUser SiteColumn SharePoint 2013

Have you ever tried to create a site column using a feature , how many times you searched for the correct  format and syntax , I've tried to add multiple Person column to a custom content type
and instead of googling and copy and paste the code I came up with another way to get the Field Schema without google help !

I created a dummy custom list

  • Add an App

  • Choose custom List


  • Type the list name in my case I Typed "TestList"


  • Check if the list has been created



  •  Go to List ->List Settings


  • Add New Column , Type PeopleMulti , Choose Person or Group



  • Choose allow multiple values, People Only



Using Power Shell type the below 2 lines to export the field schema to XML file 




here is the UserMulti field , don't forget to change the Field ID 

<Field Type="UserMulti"
      DisplayName="PeopleMulti" 
      List="UserInfo"
      Required="FALSE"
      EnforceUniqueValues="FALSE"
      ShowField="ImnName"
      UserSelectionMode="PeopleOnly"
      UserSelectionScope="0" 
      Mult="TRUE"
      Sortable="FALSE"
      ID="{87C0735C-394D-4783-BDAD-1C997EF2B9AF}"
      StaticName="PeopleMulti" Name="PeopleMulti"
       />

Note remove the source ID from the generated XML , you can use the same method to get any Field Schema to help you create Custom Content Type using Visual studio