Esempio n. 1
0
        public ActionResult Details(int id)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
            using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
            {
                var service = new PartSuppliersService(clientContext);
                var item = service.GetItem(id);
                if (item == null) return HttpNotFound();

                var workflowSubscription = service.GetWorkflowSubscription("Approve Suppliers");

                ViewBag.AppWebUrl = spContext.SPAppWebUrl.ToString();
                ViewBag.WorkflowSubscription = workflowSubscription;
                ViewBag.WorkflowInstance = service.GetItemWorkflowInstance(workflowSubscription.Id, id);
                ViewBag.ApprovalTask = service.GetApprovalTaskForCurrentUser(id);

                return View(item);
            }
        }