In this post we will discuss how to create a list based autohosted app in SharePoint 2013. Also you can check out my previous posts on:
– How to change site logo in SharePoint 2013?
– Change column name of list using SharePoint 2013 client object model in autohosted apps
– Add Custom Actions to List Item Menu in SharePoint 2010 Using SharePoint Designer 2010
Follow below steps:
Open Visual Studio 2012, Go to File -> New Project.
Then in the New Project dialog box, go to Office/SharePoint under Visual C#.
Then select App for SharePoint 2013 template as shown in the fig below:
Then in the next dialog box Give a name for the App, local debugging URL and then Choose the Autohosted hosting option as shown in the fig below:
On the Project menu, choose Add, New Item. When the Add New Item dialog box opens with the Office/SharePoint templates, choose List.
Specify name of the list, and choose Add.
After you add the list to the solution, you can add a column to the list using the user interface.
Add the following code inside the body of the default.aspx page.
<p>Click on TOD List for adding the thought in that list</p>
<asp:HyperLink ID=”HyperLink1″ runat=”server” Target=”_blank”>TOD</asp:HyperLink>
Add the following code in code behind under Page_load method in default.aspx.cs
string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
SharePointContextToken contextToken =
Uri sharepointUrl = new Uri(Request.QueryString[“SPAppWebUrl”]);
HyperLink1.NavigateUrl = sharepointUrl.AbsoluteUri + “/Lists/TOD”;
Where TOD is a list name.
Now you deploy the apps and click that link than you able to show the list in autohosted apps.