Posted on March 4th, 2014
In this article you will learn how to provision site columns in office 365 using Visual Studio 2012 or 2013 with the help of SharePoint 2013 Client browser tool.
Lets start provisioning the site columns...
1. Open Visual Studio 2012 or 2013.
2. Click File – [New] – [Project] - SharePoint solutions.
3. Select SharePoint 2013 – Empty Project template.
4. Name the project “SharePointProject_SiteColumns”.
5. Enter the site you want to debug and select Sandbox solution.
6. Create folder for grouping similar artifacts, in this case Site Columns.
7. To create a new folder, Right click on the project - [Add] – [New Folder], name it as Site Columns.
While developing the solution we will be taking help of
SharePoint 2013 client browser tool is Awesome one, using which you can connect to your office 365 SharePoint site from client side. You can download the tool from codeplex.
In this article we will be using SharePoint 2013 client browser tool to get the schema of the columns.
Lets continue the development..
8. Create a all the required columns(Department,Team Name) in an one of the list(Team details) within the site and get the Schema XML using SharePoint 2013 client browser tool to use that while developing site columns using Visual Studio.
9. To add a new site column, right click on Site Columns folder and [Add]-[New Item] -[Site Column].
Name Site Column as department. Use the client browser tool to get the Schema XML and replace the Element.xml generated for Department column from Visual Studio.
Repeat this step for all the required site columns to be build.
10. Change the Feature1 to "SPJ Site Columns" and update the description of the feature. Once everything is done the solution explorer looks like below.
11. If you want to activate the feature manually go to project properties - select SharePoint –Set Active deployment configuration to “No Activation”.
12.Right click on project to publish the solution. Please see the below figure.
Always keep an eye on Output window in visual studio to know what is happening behind the scenes.
13. From the Solution Gallery activate the solution published.
14. Go to [Site settings]-[Manage site features under Site Actions]- activate your feature.
15. Go to [Site Settings]-[Site Columns under Web Designer Galleries]. Select "SPJ Site Columns" under Show group.
You can see your Department and Team Name site columns.
SharePointProject_SiteColumns solution files can be found here.
In this article you have learned how to develop site columns using Visual Studio with declarative approach. We believe when you are provision the artifacts in host web its always keep the things isolated from App web would be helpful.
If you are provisioning the site columns in SharePoint online What is your approach? let us know.
Devendra Velegandla is a five-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2019) for Office Apps and Services, Office Servers and Services MVP and SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.