/office-add-in-saas-monetization-sample

Monetize your Office 365 add-in through Microsoft Commercial Marketplace

Primary LanguageJavaScriptMIT LicenseMIT

page_type products languages extensions description
sample
office-outlook
office-365
office-sp
javascript
contentType technologies createdDate
samples
Add-ins
2/14/2020 12:00:00 PM
Learn how to create a simple license management system to manage Add-ins sold in Microsoft AppSource.

Introduction

This code sample demonstrates how Microsoft ISVs can create a simple license management system to manage Add-ins sold in Microsoft AppSource. This code sample package includes a Microsoft AppSource mock web app, a SaaS sample, a SharePoint Framework (SPFx) add-in, Outlook, Word, Excel, and PowerPoint Add-ins, and a licensing management tool.

Installation and configuration

Follow the instructions in the deployment guides to install and configure the sample.

Testing

Follow the instructions in the test guide to test the different use cases.

Inventory

This section links to the various README files associated with the projects included in the sample. Read the README files for more information about each project.

Appendix

UX / API Mapping

This matrix describes the UI actions and how they correlate to different API calls.

UI where the API is invoked API call Able to test the production API without the offer being published to the public?
Resolve a subscription in purchase process:

HttpPost
https://marketplaceapi.microsoft.com/api/saas/subscriptions/resolve?api-version=2018-09-15
No
Activate a subscription in purchase process:

HttpPost
https://marketplaceapi.microsoft.com/api/saas/subscriptions/0aa95e32-8be7-4e5e-94f9-563f6d7d9dcd/activate?api-version=2018-09-15
No
Update the quantity on the subscription in plan/quantity changed process

HttpPatch
https://marketplaceapi.microsoft.com/api/saas/subscriptions/0aa95e32-8be7-4e5e-94f9-563f6d7d9dcd?api-version=2018-09-15

Note: Although the patch request works, but actually the test data will not be updated, and the web hook will not be triggered as well.
No
Update the status of an operation in plan/quantity changed process

HttpPatch
https://marketplaceapi.microsoft.com/api/saas/subscriptions/0aa95e32-8be7-4e5e-94f9-563f6d7d9dcd/operations/7688ae05-1579-4fdd-be89-12b45f0a4ef3?api-version=2018-09-15
No
Query operations in plan/quantity changed process

HttpPatch
https://marketplaceapi.microsoft.com/api/saas/subscriptions/0aa95e32-8be7-4e5e-94f9-563f6d7d9dcd/operations?api-version=2018-09-15
No
Webhook on the SaaS service No

SharePoint Add-ins Note

A Provider-Hosted SharePoint Add-in cannot target a .NETCORE web project. In this sample, the Provider-Hosted SharePoint Add-in web project targets a .NET Framework project.

In all of the other Add-ins in this sample, we get the OfferID from the SaaSOfferMockData project. However, the SaaSOfferMockData project is a .NETCORE project. Therefore, we cannot reference it in the Provider-Hosted SharePoint Add-in project. Additionally, we cannot reference it in the SharePoint-Hosted Add-in project, because we use JavaScript to query license status.

To work around this technical limitation, the OfferID is hardcoded in the AzureADAuthController.cs class in the Provider-Hosted Add-in, and it is hardcoded in the app.js file in the SharePoint-Hosted Add-in.

Copyright

Copyright (c) 2020 Microsoft Corporation. All rights reserved.