SharePoint 2013: Import, validate, and manage app licenses

Learn how to import and manage app licenses, as well as how to retrieve, validate, and communicate licensing states in your apps for SharePoint. Using the tools in the sample, developers can import test licenses, validate licenses, and manage license assignment within SharePoint.

C# (2.2 MB)
4.4 Star
1,676 times
Add to favorites
E-mail Twitter Digg Facebook

Solution explorer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LicenseSPAppSampleWeb.Pages
    public partial class Home : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            string contextToken = TokenHelper.GetContextTokenFromRequest(Request);

            //Save objects to the session so other pages can use them 
            Session["contexToken"] = contextToken; 
            Session["SPHostUrl"] = Request.QueryString["SPHostUrl"];
            Session["SPAppWebUrl"] = Request.QueryString["SPAppWebUrl"];
            viewLicenses.NavigateUrl = Session["SPHostUrl"] + "/_layouts/15/AllAppLicensesManagement.aspx";