Project Description

Create test licenses for SharePoint and Office Add-Ins (Apps). Compatible with SharePoint 2013 and Office 365 SharePoint Online.

Source code moved to Github:
https://github.com/bandrben/SPAppLicenseHelper

Introduction

Inspired by the much recommended "SharePoint 2013: Import, validate, and manage add-in licenses" autohosted Add-In (app) that allows you to import and manage licenses, and it also has code that shows how to retrieve, validate, and signal licensing states. This program is critical for importing Test Licenses within a SharePoint Site since the Licensing API requires a lot of XML munching and understanding of the Add-In (App) License Schema from MSDN. Recently I needed to create a Test App License for my SharePoint Add-In for the Office Store. But, autohosted apps are no longer supported, even so I tried to install and activate the Add-In, but no good, the solution cannot be activated. After much searching I didn't find another solution for creating Add-In Licenses, so time to bust out my favorite code editor and build me a license...

This product is meant to remedy this by creating a desktop tool that imports Test Licenses for SharePoint Add-Ins. I borrowed heavily from the Microsoft hosted solution found here: https://code.msdn.microsoft.com/officeapps/SharePoint-2013-Import-f5f680a6/sourcecode?fileId=85458&pathId=1774172510.

Also, I have to thank the following blogs for providing the knowledge on finding this code and using it:
http://keutmann.blogspot.com/2013/02/sharepoint-2013-hosted-app-license-check.html
http://blogs.msdn.com/b/officeapps/archive/2012/11/09/licensing-your-apps-for-sharepoint.aspx

SharePoint Add-In Licensing in a nutshell consists of three main steps:
  1. Import a test license
  2. Add code to your app that retrieves and validates the license
  3. Make decisions based on the outcome.

This project's goal is make step 1 "Import a test license" painless and easy. The other 2 steps have many code samples available on the web and best practices available from Office Dev Center and blogs.

Features

  • WinForms desktop application using .NET 4.5.1
  • Uses SharePoint Client Object Model
  • Compatible with SharePoint 2013, Office365 SharePoint Online
  • Works with Windows Auth sites and Claims Based sites
  • Default settings are configured for creating SharePoint Test Licenses, but settings can be changed to try to create licenses for Office Add-Ins/Apps and subscription based apps.
  • Advanced settings to import Licenses with different App Sub Types, acquisition date, purchase date, token expiration date, subscription status, content and billing market languages.
  • Remembers last login information using registry.

Definitions

For more information on definitions visit
https://msdn.microsoft.com/en-us/library/office/jj163880.aspx
https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.utilities.utility.importapplicense.aspx
  • APP TITLE: The name of the app.
  • PRODUCT ID: The GUID that represents the product ID of the app. The product ID of the app is specified in the app manifest.
  • PROVIDERNAME: Name of the provider of the app.
  • APICONURL: URL of the app icon, as it appears on Office Store. Can be left blank.
  • CUSTOMER ID: Represents the purchaser ID. This is an encrypted value of the Microsoft account used by the purchaser of the app.
  • LICENSE TYPE: Enumeration that represents the type of app license. Valid values include Free, Paid, and Trial.
  • USER LIMIT: Integer representing the total number of users licensed to access this app, by this purchaser, for apps that are site licensed, this value is 0, this attribute does not apply to apps for Office.
  • EXPIRATION: used to create the expiration date, UTC time-date stamp that represents the expiration date for the app license.
  • APPSUBTYPE: The subtype of the app. Use this parameter to specify whether this license is for an app for SharePoint used exclusively to package an app for Office, and if so, the type of app for Office. This enables corporate catalogs to filter and display apps for Office packaged in apps for SharePoint.
  • ASSETID: The asset ID assigned to this app by the Office Store.
  • LICENSE ACQUISITION DATE: UTC time-date stamp that represents the acquisition date for the app license.
  • INITIAL PURCHASE DATE: UTC time-date stamp that represents one of the following: the initial purchase of the license; the latest manual license recovery time, if the purchaser has performed such a recovery using their Microsoft account.
  • LICENSE TOKEN EXPIRATION DATE: UTC time-date stamp that represents the date the current app license token expires.
  • SUBSCRIPTION STATUS: Represents the subscription status of the app license. This attribute is optional for apps that are not being sold as subscriptions.
  • CONTENTMARKET: The content market in which you want to sell the app.
  • BILLINGMARKET: The billing market for the app.
  • IS TEST LICENSE: Indicates if creating/importing a test license.

Screenshots

Main screen, first tab is used to set connection info, can connect to SP2013 On Premise and Office365 SPOnline. Also use the "Open SP License Manager" link to easily navigate to the built-in SharePoint out of box license management pages.
screen1a.png

Second tab is used to configure the license and create it. Its split into 2 sections, use the Advanced Settings section to try different license settings.
screen2a.png

Sources and More Information

Doing SharePoint Stuff - SharePoint 2013 hosted App License check
by Carsten Keutmann
Now you need to test you licensing code. Do this by installing a test License key, so you are able to test your app. Further reading on the subject can be found on Licensing your apps for SharePoint. Download file 4760.LicenseSPAppSample.zip.
http://keutmann.blogspot.com/2013/02/sharepoint-2013-hosted-app-license-check.html

Apps for Office and SharePoint blog - Licensing your apps for SharePoint
by Ricardo Loo
Import a test license. The sample mentioned above is an autohosted app that you can deploy on your Office 365 Developer Site.
To import a test license, all you have to do is run the app and select the type of license you want to import. Or, you can also import licenses using our APIs, as described in How to: Add license checks to your app for SharePoint. But I highly recommend using the app instead; it will save you munching XML. The sample app and tools are shown here.
http://blogs.msdn.com/b/officeapps/archive/2012/11/09/licensing-your-apps-for-sharepoint.aspx

Office Dev Center - 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.
https://code.msdn.microsoft.com/officeapps/SharePoint-2013-Import-f5f680a6/sourcecode?fileId=85458&pathId=1774172510

Office Dev Center - How to: Add license checks to your app for SharePoint
https://msdn.microsoft.com/en-us/library/office/jj164035.aspx

Office Dev Center - Utility.ImportAppLicense method
https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.utilities.utility.importapplicense.aspx

Office Dev Center - App License Schema
https://msdn.microsoft.com/en-us/library/office/jj163880.aspx

Office Store - Cheezburgers
By Bill Avery
Browse the latest LOLs, FAILs, memes, and graphs from the Cheezburger Network RSS feeds from right inside of your MySite.
https://store.office.com/cheezburgers-WA103524926.aspx



Created by Benjamin Steinhauser of B&R Business Solutions.

Last edited Jul 25 at 6:57 AM by bandrben, version 11