Click here to Skip to main content
15,888,270 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to add an license check to my office add in like described in "Add license checks to Office and SharePoint Add-ins"
C#
public partial class Home : System.Web.UI.Page
    {
        public string etoken = "";
        private static VerificationServiceClient service = new VerificationServiceClient();
        protected void Page_Load(object sender, EventArgs e)
        {
            etoken = Request.QueryString["et"];

            if (etoken == null)
            { 
                AddInDisabled.Visible = true;
                AddInDisabled.InnerHtml = "no license";
                AddInBody.Visible = false;        
            }
            else
            {
                CallVerificationService(etoken);
                AddInDisabled.Visible = false;
                SetLanguage(Thread.CurrentThread.CurrentCulture.Name);                
            }

        }

        private void CallVerificationService(string etoken)
        {
            VerifyEntitlementTokenRequest request = new VerifyEntitlementTokenRequest();
            request.EntitlementToken = DecodeToken(etoken);
            VerifyEntitlementTokenResponse omexResponse = service.VerifyEntitlementToken(request);          
        }

        private static string DecodeToken(string encodedToken)
        {
            byte[] decodedBytes = Convert.FromBase64String(encodedToken);
            return Encoding.Unicode.GetString(decodedBytes);
        }

all values of omexRespons are equal false

What I have tried:

The toc file is in the same folder as the xml and same name I copied the example toc from "Add license checks to Office and SharePoint Add-ins" I only changed the ID and "et" = "Paid"

Am I doing something wrong? I want to check if it is a Paid license.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900