In this post we will discuss how we can add lookup field type column in list using visual studio 2013 by autohosted apps in sharepoint 2013.
Also you can check my previous posts on:
– Difference between SharePoint-hosted, auto-hosted and Provider-hosted apps in SharePoint 2013
– Embed word document into SharePoint 2013 site
– Architectural changes in SharePoint 2013
Follow below steps:
1. Open Visual Studio, then Add New Project and then select “App for SharePoint 2013” as shown in the fig below:
2. Visual Studio will ask you about some details of your new application as shown in the fig below:
3. Below is your visual studio solution explorer now:
4. When settings are okay click Finish and see what Visual Studio generated for you.You have two projects – one for SharePoint app and the other for web application that contains actual application logic and server-side code.
5. Now right click SharePoint apps and add new item as a list.
6. Add two list like list1 and list2
7. Now by default in list Title column is already in the list1 and list2
8. Now select list2 and add one column1 and type is lookup.
9. Now select the column1 from list2 and go to properties
10. Here you find the Type, under this you add list1 and add show field as Title (Title is lookup field from list1). see as a image
11. Now you deploy the apps in your site and add item in list1 and then go to list2 and you will able to see the lookup value to list2 as a column1 field.