protected void Page_Load(object sender, EventArgs e) { Act act = new Act(Web); if (act.CheckFeatureLicense(ActFeature.AppsAndCommunities) != 0) { Microsoft.SharePoint.Utilities.SPUtility.Redirect("epmlive/applications/noact.aspx", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current); } API.ApplicationDef appDef = API.Applications.GetApplicationInfo(Request["AppId"]); ApplicationName = appDef.Title; sFullWebUrl = Web.Url; try { SPList oList = Web.Lists.TryGetList("Installed Applications"); if (oList != null) { SPListItem li = oList.GetItemById(int.Parse(Request["CommId"])); API.Applications.AddAppToCommunity(li, int.Parse(Request["AppId"])); } sbOutput.Append("<div class=\"alert alert-success\">This application has been successfully added to the community.</div>"); } catch (Exception ex) { sbOutput.Append("<div class=\"alert alert-error\">There was an error adding this application to the community: " + ex.Message + "</div>"); } }
protected void Page_Load(object sender, EventArgs e) { Act act = new Act(Web); if (act.CheckFeatureLicense(ActFeature.AppsAndCommunities) != 0) { Microsoft.SharePoint.Utilities.SPUtility.Redirect("epmlive/applications/noact.aspx", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current); } API.ApplicationDef appDef = API.Applications.GetApplicationInfo(Request["AppId"]); if (appDef.Community != "") { Microsoft.SharePoint.Utilities.SPUtility.Redirect("epmlive/applications/precheck.aspx?appid=" + Request["appid"] + "&CommId=", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, System.Web.HttpContext.Current); } else { string curapp = ""; try { curapp = Request["CommId"].ToString(); } catch { } if (curapp == "") { AppSettingsHelper helper = new AppSettingsHelper(); curapp = helper.CurrentAppId.ToString(); } SPList oList = Web.Lists.TryGetList("Installed Applications"); SPQuery query = new SPQuery(); query.Query = "<Where><IsNull><FieldRef Name='EXTID'/></IsNull></Where><OrderBy><FieldRef Name='Title'/></OrderBy>"; foreach (SPListItem li in oList.GetItems(query)) { System.Web.UI.WebControls.ListItem listitem = new System.Web.UI.WebControls.ListItem(li.Title, li.ID.ToString()); if (String.Equals(li.ID.ToString(), curapp)) { listitem.Selected = true; } ddlCommunity.Items.Add(listitem); } query = new SPQuery(); query.Query = "<Where><And><Eq><FieldRef Name='EXTID' /><Value Type='Number'>" + Request["AppId"] + "</Value></Eq><Eq><FieldRef Name='Status'/><Value Type='Text'>Installed</Value></Eq></And></Where>"; SPListItemCollection lic = oList.GetItems(query); if (lic.Count > 0) { pnlInstalled.Visible = true; bNavOnly = "true"; } } }
protected void Page_Load(object sender, EventArgs e) { Act act = new Act(Web); if (act.CheckFeatureLicense(ActFeature.AppsAndCommunities) != 0) { Microsoft.SharePoint.Utilities.SPUtility.Redirect("epmlive/applications/noact.aspx", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current); } API.ApplicationDef appDef = API.Applications.GetApplicationInfo(Request["AppId"]); ApplicationName = appDef.Title; }
protected void Page_Load(object sender, EventArgs e) { SPList oList = API.Applications.GetApplicationList(Web); API.ApplicationDef def = API.Applications.GetApplicationInfo(Request["appid"]); ApplicationName = def.Title; XmlNode ndStatus = API.Applications.CheckUninstallStatus(Request["jobuid"], SPContext.Current.Web); try { XmlDocument doc = new XmlDocument(); doc.LoadXml(System.Web.HttpUtility.HtmlDecode(ndStatus.SelectSingleNode("Message").InnerText)); DataTable dt = new DataTable(); dt.Columns.Add("Status"); dt.Columns.Add("Message"); dt.Columns.Add("Detail"); dt.Columns.Add("Level"); appendTable(0, dt, doc.FirstChild); GridView2.DataSource = dt; GridView2.DataBind(); switch (maxError) { case 0: case 1: sbOutput.Append("<div class=\"alert alert-success\">The application has been successfully removed.</div>"); break; case 5: sbOutput.Append("<div class=\"alert alert-warning\">The application has been removed but 1 or more warnings occured. Click view details for more information.</div>"); break; case 10: sbOutput.Append("<div class=\"alert alert-error\">The application has failed to uninstall. Click view details for more information.</div>"); break; } ; } catch { sbOutput.Append("Error: " + ndStatus.SelectSingleNode("Message").InnerText); } }
protected void Page_Load(object sender, EventArgs e) { sFullWebUrl = Web.Url; API.ApplicationDef appDef = API.Applications.GetApplicationInfo(Request["AppId"]); ApplicationName = appDef.Title; if (appDef.Community != "") { try { SPList list = API.Applications.GetApplicationList(Web); SPQuery query = new SPQuery(); query.Query = "<Where><Eq><FieldRef Name='EXTID' /><Value Type='Number'>" + Request["AppId"] + "</Value></Eq></Where>"; SPListItemCollection lic = list.GetItems(query); if (lic.Count > 0) { newAppId = lic[0]["LinkedCommunity"].ToString(); } } catch { } } else { try { newAppId = Request["CommId"].ToString(); } catch { } } int jobid = 51; XmlNode ndStatus = API.Applications.GetApplicationStatusMessage(Request["AppId"], SPContext.Current.Web, jobid); string sStatus = ndStatus.SelectSingleNode("Status").InnerText; string sMessage = ndStatus.SelectSingleNode("Message").InnerText; sMessage = System.Web.HttpUtility.HtmlDecode(sMessage); XmlDocument doc = new XmlDocument(); try { doc.LoadXml(sMessage); DataTable dt = new DataTable(); dt.Columns.Add("Status"); dt.Columns.Add("Message"); dt.Columns.Add("Detail"); dt.Columns.Add("Level"); appendTable(0, dt, doc.FirstChild); GridView2.DataSource = dt; GridView2.DataBind(); switch (maxError) { case 0: case 1: sbOutput.Append("<div class=\"alert alert-success\">This application has successfully installed into your community.</div>"); break; case 5: sbOutput.Append("<div class=\"alert alert-warning\">This application has been installed in your community but there was 1 or more warnings. Click view details to get more information.</div>"); break; case 10: sbOutput.Append("<div class=\"alert alert-error\">This application has been installed in your community, but there was 1 or more errors during install. Click view details to get more information.</div>"); break; } ; } catch { sbOutput.Append("Error: " + sMessage); } }
protected void Page_Load(object sender, EventArgs e) { Act act = new Act(Web); if (act.CheckFeatureLicense(ActFeature.AppsAndCommunities) != 0) { Microsoft.SharePoint.Utilities.SPUtility.Redirect("epmlive/applications/noact.aspx", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current); } API.ApplicationDef appDef = API.Applications.GetApplicationInfo(Request["AppId"]); ApplicationName = appDef.Title; sWebUrl = Web.ServerRelativeUrl; int jobid = 51; if (appDef.bIsConfigOnly) { jobid = 52; } XmlNode ndStatus = API.Applications.GetApplicationStatusMessage(Request["AppId"], SPContext.Current.Web, jobid); string sStatus = ndStatus.SelectSingleNode("Status").InnerText; string sMessage = ndStatus.SelectSingleNode("Message").InnerText; sMessage = System.Web.HttpUtility.HtmlDecode(sMessage); XmlDocument doc = new XmlDocument(); try { doc.LoadXml(sMessage); DataTable dt = new DataTable(); dt.Columns.Add("Status"); dt.Columns.Add("Message"); dt.Columns.Add("Detail"); dt.Columns.Add("Level"); appendTable(0, dt, doc.FirstChild); GridView2.DataSource = dt; GridView2.DataBind(); switch (maxError) { case 0: case 1: sbOutput.Append("<div class=\"alert alert-success\">This application has successfully passed the precheck.</div>"); break; case 5: sbOutput.Append("<div class=\"alert alert-warning\">This application has passed the precheck but there are 1 or more warnings. Click view details to get more information.</div>"); break; case 10: sbOutput.Append("<div class=\"alert alert-error\">This application has failed to pass the precheck. Click view details to get more information.</div>"); break; } ; } catch { sbOutput.Append("Error: " + sMessage); } }