2

I need to create different types of fields using CSOM in a list. I got stuck with the External data field. So I wanted to ask, is it possible to create external data field in a list using CSOM?

2
  • Custom development with C#?
    – Ram
    Dec 5, 2016 at 9:12
  • Yes custom development
    – KumarV
    Dec 5, 2016 at 9:23

3 Answers 3

2

yes, It is possible to create external data field in a list using CSOM.

<Field
       ID="{3F1AAE19-964D-4B0C-B200-F0011FA97126}"
       Name="DescriptionTitle" Hidden="FALSE" StaticName="DescriptionTitle"
       DisplayName="Description Title" Type="Text" Required="FALSE" Group="Test">
  </Field>
<Field
     ID="{5C0E78EB-5D22-4D88-82DD-CB5C14496BAD}"
     Name="Icon" Hidden="FALSE" StaticName="Icon"
     DisplayName="Icon" Type="Image" RichText="TRUE" RichTextMode="ThemeHtml" Required="FALSE" Group="Test">
  </Field>
  <Field
    ID="{80C6CE62-BB42-419C-BF00-B7B60108CF61}"
    Name="CalendarContent" DisplayName="Calendar Content"
    Hidden="FALSE" RichText="TRUE" RichTextMode="FullHtml" StaticName="CalendarContent"
    Type="HTML" Required="False" Group="Test">
  </Field>

Click here for Reference URL. Hope this will help you.

0

You can very well update external data column using CSOM. Please refer below link-

https://blogs.msdn.microsoft.com/kaushalendra/2012/04/01/updating-external-data-column-using-client-object-model/

For creating columns/field, please refer - https://msdn.microsoft.com/en-us/library/ee231593.aspx

0

I case anyone needs to create external columns again. The below code worked perfectly for me. In my case the external field was pointing to a WCF service.

context.Load(web);
context.ExecuteQuery();
string businessFieldSchema = "<Field Type='BusinessData' DisplayName='Display name here' Required='FALSE' EnforceUniqueValues='FALSE' " +
                "SystemInstance='System Instance as on BCS here' EntityNamespace='Namespace as on BCS' EntityName='Entity name as on BCS' BdcField='Name of the entity field'" +
                " Group='Field Group here' Hidden='FALSE' UnlimitedLengthInDocumentLibrary='FALSE' " +
                " StaticName='Static Name Here' Name='Name Here'/>";
var businessField = allFields.AddFieldAsXml(businessFieldSchema, false, AddFieldOptions.AddFieldInternalNameHint);
businessField.Update();
context.Load(businessField);
context.ExecuteQuery();

-Hope it helps

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.