public ActionResult GetLists2() { var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext); using (var clientContext = spContext.CreateUserClientContextForSPHost()) { var lists = SharePointListManager.GetLists2(clientContext); ViewBag.lists = lists; return(View()); } }
public ActionResult CreateAnnouncementsList() { // create the list in the host web var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext); using (var clientContext = spContext.CreateUserClientContextForSPHost()) { SharePointListManager.CreateAnnouncementsList(clientContext); } // redirect to page which displays list collection and new list return(RedirectToAction("GetLists2", new { SPHostUrl = Request["SPHostUrl"] })); }