I have created a SharePoint 2013 provider hosted app using visual studio. It don't use the web parts. I have to retrieve the data from the SharePoint 2013 list residing on the SharePoint site collection.I can do that with visual web part by this code
private DataTable GetItemDetails()
{
SPWeb spweb = SPContext.Current.Web;
SPList ticketsList = spweb.GetList("[http://git-hub/sites/mysiteName/Lists/CalendarList/AllItems]");
return ticketsList.Items.GetDataTable();
}
This gave me table of items and I used that table to get the required data. But the problem is now I want use same data my SharePoint app which is made of asp.net pages with c# code behind. I used the same code but it giving me error like "
Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable." Even I am using any plate form in app build settings. Please let me know if any way I can retrieve the list data in asp.net page to show the user their schedules.
you can also use Managed client object model :
Uri hostWeb = new Uri(Request.QueryString["SPHostUrl"]);
List<string> listOfUsers = new List<string>();
using (var clientContext = TokenHelper.GetS2SClientContextWithWindowsIdentity(hostWeb, Request.LogonUserIdentity))
{
List oList = clientContext.Web.Lists.GetByTitle("TestList");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Geq><FieldRef Name='ID'/>" +
"<Value Type='Number'>0</Value></Geq></Where></Query><RowLimit>100</RowLimit></View>";
Microsoft.SharePoint.Client.ListItemCollection collListItem = oList.GetItems(camlQuery);
clientContext.Load(collListItem);
clientContext.ExecuteQuery();
foreach (Microsoft.SharePoint.Client.ListItem oListItem in collListItem)
{
listview.Add(string.Format("ID: {0} \nTitle: {1}", oListItem.Id, oListItem["Title"]));
}
ListList.DataSource = listOfUsers;
ListList.DataBind();
}