I have created a BDC model using Visual Studio and deployed it using a WSP to the server.

Next I want to add an External Data Column (Field) using a External Content Type in the BDC model to an existing (generic) list using powershell.

How would I do this? I don't want to do this manually for each list using the UI or SharePoint designer as I want to automate the process and have it repeatable.

1 Answer 1


You can create field schema for your external data column. You can follow this link for doing it.

Then use following PowerShell script to create field into list

$web = Get-SPWeb "Web Url"
$list = $web.Lists["Your List Title"]
$fields = $list.Fields
$firstNameColXml = "Your field schema here"
$noteFieldSchema = "Your note field schema"

$fieldBCS = $fields.AddFieldAsXml($firstNameColXml,$true [Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView) 
$fieldBCS .update()

$fieldBCSNote = $fields.AddFieldAsXml($noteFieldSchema,$true,

Your field schema should be as follows

For BCS Field

   <Field Type="BusinessData" 
   DisplayName="test" Required="FALSE" 
   StaticName="test" BaseRenderingType="Text"
   Name="test" SystemInstance="[External System]" 
   EntityNamespace="[Namespace]" EntityName="[Name]" 
   BdcField="[Field Name in BCS]" HasActions="True" 
   SecondaryFieldBdcNames="0" RelatedField="[Field Name in BCS]" 
   SecondaryFieldWssNames="0" RelatedFieldBDCField="" 
   RelatedFieldWssStaticName="[Field Name in BCS]"       SecondaryFieldsWssStaticNames="0" AddFieldOption="AddToAllContentTypes, AddFieldToDefaultView" />

For Note field

<Field Type="Note" DisplayName="[Field display name]" Hidden="TRUE"       ReadOnly="TRUE"BdcField="[Field Name in BCS]" ID="{9c03ea22-4a95-4902-b549-90ff7a624530}" StaticName="[Field Name in BCS]" Name="[Field Name in BCS]"/>

Hope it will help to you

  • What is the noteField? Is it what is seen in the views?
    – pac w
    Jun 2, 2015 at 8:55
  • It is one hidden field used by sharepoint. When you create External Data from UI then that field will be automatically added by SharePoint Jun 2, 2015 at 9:11
  • The ID attribute, do I set it to whatever?
    – pac w
    Jun 2, 2015 at 9:19
  • Yes. you can set any random GUID. Jun 2, 2015 at 9:20
  • I got the XML for the external data and notes fields by first adding the external data column using the UI and then using powershell to extract their SchemaXml. I removed all attributes not mentioned in the answer and then it worked.
    – pac w
    Jun 2, 2015 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.