SharePoint Online: Site Asset Provisioning Programatically
Love it or hate it, for any given requirement, Microsoft always comes up with multiple solutions i.e. there are more than one ways of achieving a goal.
So in case of assets provisioning such creating site columns, Content types and list etc. on a SharePoint Online programatically, developers got following ways:
- Provision SharePoint assets from your SharePoint client-side web part
- So the idea is when you develop your SPFx webpart, provision your site columns, content types and List along with it.
- SharePoint site template and site script
- Site scripts are rather JSON files comprising of an ordered list of site objects such as site column, content types lists, site logo etc .
- This script can be applied to the site using the on site using site setting and apply Site template option or you can use POwerShell and Rest APi as well.
- Create a Content Type using PowerShell:
- Pnp PowerShell can be used to create site column, content types and lists.
- So the idea is when you develop your SPFx webpart, provision your site columns, content types and List along with it.
- Site scripts are rather JSON files comprising of an ordered list of site objects such as site column, content types lists, site logo etc .
- This script can be applied to the site using the on site using site setting and apply Site template option or you can use POwerShell and Rest APi as well.
- Pnp PowerShell can be used to create site column, content types and lists.
Of course there are other ways as well such a CSOM, REST and spmeta2 but above are pretty much standard.
I would go for option one, if I have an Add-in/Extension depending on some lists and content types.
Cheers
Comments
Post a Comment