Office365 Automation: Provision Lists & List items using App model
On SharePoint
In this post I will explain in details how to provision Lists and list items using a Provider hosted app and a declarative XML files to define List Schema and Sample data items. This tutorial will use the App installed and uninstalled remote event receivers to do the task!
First what you need to have is:
First what you need to have is:
- SharePoint online or Office365 subscription.
- Visual Studio.
- Windows Azure subscription.
- Sellerdashboard account
What you need to do is:
- Create new SharePoint App project
- Choose the app to be provider hosted and choose your target site
- Login to your Office365
- Create a Folder Called ListDefinitions
- Under the folder create 2 XML files for 2 custom lists
- CountryList.xml
- CityList.xml
- Enable the App remote event receivers for both installed and uninstalling events.
- As you can see I've created 2 methods in the AppEventReceiver.svc.cs to handle List Creation and deletion.
- Now to your Azure subscription we need to create a website to host our event receivers
- Download the publishing profile
- Create ClientId for your app.
- Import your publishing profile
- Publish the app using the obtained Client key and secret
- Upload the app to your app catalog or simply run the SharePoint solution
- Add the app
- Trust the app.
- wait for a while until the remote event receiver creates the two custom lists and add the sample data items to them.
- You can check the inserted data and the correct lookup column reference in the city list
You can download the code sample from here
No Comment to " Office365 Automation: Provision Lists & List items using App model "