I am creating a provider-hosted Sharepoint add-in that need to create some custom lists and content types during installation.
I have setup an Event Receiver to capture when the add-in has been installed (based on: https://msdn.microsoft.com/en-us/library/office/jj220052.aspx) and am now trying to work out the best way to define the list and field to be added.
One way is to just define each field in the code, but that seems difficult to maintain and could get ugly really fast.
Looking at the ListCreationInformation
class being used to create the list, it has a CustomSchemaXml
field. Is it possible to somehow get the text from inside the Schema.xml
file that Visual Studio creates when adding a new List element (maybe by building it to the output directory and reading it using reflection)?
(ignore the temporary name)
Or, am I barking up completely the wrong tree? In which case is there a better way to define lists and content types to be installed with the application (also taking into consideration potential updates later on)?
Thanks