1

Word of caution: This question is related to question How to create ContentType with FieldLinks using REST but is more specific as we are looking to find a solution until (if?) MS brings the API Change to make it possible

We were attempting to create a Content type and site columns in a SharePoint-addin programmatically, as well as to associate them using primarily REST. Here is the code used to create our list: REST Code to provision list

Afterwards we proceeded to create the columns, also using REST (reference doumentation MSDN site column reference : REST Code to Provision columns

Next we created the Content type using JSOM, as it is not possible to create Content types using REST on the web Level (at least we got Bad Request). The same REST-attempts using http:////_api/web/lists(listid)/contenttypes (for single lists) worked, but we wanted to do the association at CT-Level, not at list-Level.

What did NOT work at all were the FieldLinks. According to Microsoft MSDN Documentation for REST-FieldLink Objects it is not possible to do this via REST.

Does anyone know one consistent way to create FieldLinks programmatically using JavaScript? It just seems to me that MS is pumping out inconsistent APIs out there and always switching APIs (REST/JSOM) within a single simple Addin is really bad coding practice.

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.