Code Monkey home page Code Monkey logo

office-add-in-saas-monetization-sample's Introduction

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.

Office Add-in SAAS monetization sample

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 Teams Tab app, a Teams Bot(C#) app, a Teams Bot(JavaScript) app, 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-08-31]
No
'' Activate a subscription in purchase process:

HttpPost
[https://marketplaceapi.microsoft.com/api/saas/subscriptions/0aa95e32-8be7-4e5e-94f9-563f6d7d9dcd/activate?api-version=2018-08-31]
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.

office-add-in-saas-monetization-sample's People

Contributors

bobgerman avatar cloriss avatar jamesskay-msft avatar kokuljose avatar lauragra avatar microsoft-github-operations[bot] avatar microsoftopensource avatar rabwill avatar tbag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

office-add-in-saas-monetization-sample's Issues

if "userType:null" in your tenant, then Graph users are not found and SaaS web app fails

First of all, thanks for the great examples and all your efforts. I wanted to share this since it took me quite a while to debug (but it did force me to run/debug the SaaS Web app locally which I would do eventually anyways).

Microsoft Graph beta appears to have several additional user properties, including "userType". In my tenant userType = null which causes the following line of code to not return users.

var reuslt = await graphClient.Users.Request().Filter($"userPrincipalName eq '{identity}' and userType eq 'Member'").GetAsync();

Ultimately, if the sample apps are deployed as described, this will result in a 500 internal server error but the underlying problem is really the following line of code which fails since @model is null in SaaSSampleWebApp\Views\Shared\Components\User\Default.cshtml

<span>@Model.DisplayName | @Model.JobTitle</span>

Changing the failing line to the following fixes the problem:
var reuslt = await graphClient.Users.Request().Filter($"userPrincipalName eq '{identity}'").GetAsync();

I'm not quite sure how to get userType to not be null but, either way, for production apps it seems like this check should be optional since customers (of the ISV's app) may also have the field null.

Issue can be reproduced in Graph Explorer for any user with userType: null

https://graph.microsoft.com/beta/users?$filter=userPrincipalName%20eq%20'<user email>'%20and%20userType%20eq%20'Member'

Hope this helps.

The reply URL specified in the request does not match the reply URLs configured for the application

Hello everyone,

First of all, I'd like to thank you guys for this code sample repository, it is very useful !

Context : I'm in charge of developing a SaaS offering for two brand new Excel add-ins. We already developed them. We are now at the monetization step.

I'm currently trying to replicate the tutorial from this repository. I managed to deploy the Mock WebAPI, Web App, AppSource and the Outlook Addin on Azure successfully. However, I'm stuck at the Testing step. I guess I did something wrong in the configuration, yet, sadly, I can't find/debug my mistake :(

As I follow along the documentation from this repo, I'm facing an issue when trying to connect to the MockAppSource for the first time. I attached two screenshots below :

  • the first one with the first login error : Sorry, but we’re having trouble signing you in.
    AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'c9e36b1f-f193-40b0-92b6-3c383c7bba27'.

  • the second one, with the Mock App Source redirect URIs setup : https://localhost:44381/ and https://localhost:44381/signin-oidc

Mock App Source First Login Error :

MockAppSouceError

Mock App Source Redirect URIs Setup :

MockAppSourceRedirectURIs
)

Here's the link of the MockAppSource I published if it can help : https://contosomonetizationoutlookaddin-cc1c-test3.azurewebsites.net/

Thanks for your help in advance !

how to monitaze sharepoint hosted add-in?

i have finished everything in this tutorial ,and its works fine for SharePoint framework, now i need to setup "/api/Subscriptions/CheckOrActivateLicense/{contoso_o365_addin} API in SharePoint hosted app.

  • when i call this API i get unauthorized response .

Get-MgApplication_List: Insufficient privileges to complete the operation.

By following https://github.com/OfficeDev/office-add-in-saas-monetization-sample/blob/master/Deployment/DeploymentGuide.MD, after step:

Clean up

4 . Run the script .\RemoveApps.ps1 -config .\NewApps.json.

I'm receiving:

Get-MgApplication_List: C:\Users\nagao\sandbox\office-add-in-saas-monetization-sample\Deployment\RemoveApps.ps1:15:5
Line |
  15 |      Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $app. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Insufficient privileges to complete the operation.

Remove Contoso Monetization Code Sample Web App Dev.
Get-MgApplication_List: C:\Users\nagao\sandbox\office-add-in-saas-monetization-sample\Deployment\RemoveApps.ps1:15:5
Line |
  15 |      Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $app. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Insufficient privileges to complete the operation.

Remove Contoso Monetization Code Sample Web API Dev.
Get-MgApplication_List: C:\Users\nagao\sandbox\office-add-in-saas-monetization-sample\Deployment\RemoveApps.ps1:15:5
Line |
  15 |      Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $app. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Insufficient privileges to complete the operation.

Remove Contoso Monetization Code Sample Outlook Addin Dev.
Get-MgApplication_List: C:\Users\nagao\sandbox\office-add-in-saas-monetization-sample\Deployment\RemoveApps.ps1:15:5
Line |
  15 |      Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $app. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Insufficient privileges to complete the operation.

Remove Contoso Monetization Code Sample Word Addin Dev.
Get-MgApplication_List: C:\Users\nagao\sandbox\office-add-in-saas-monetization-sample\Deployment\RemoveApps.ps1:15:5
Line |
  15 |      Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $app. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Insufficient privileges to complete the operation.

Remove Contoso Monetization Code Sample Excel Addin Dev.
Get-MgApplication_List: C:\Users\nagao\sandbox\office-add-in-saas-monetization-sample\Deployment\RemoveApps.ps1:15:5
Line |
  15 |      Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $app. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Insufficient privileges to complete the operation.

Remove Contoso Monetization Code Sample PowerPoint Addin Dev.
Get-MgApplication_List: C:\Users\nagao\sandbox\office-add-in-saas-monetization-sample\Deployment\RemoveApps.ps1:15:5
Line |
  15 |      Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $app. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Insufficient privileges to complete the operation.

Remove Contoso Monetization Code Sample App source Dev.

What should I configure to get the right permissions?

Thanks

Not quite getting it sorry

I have been building an Excel addin for some time now with the hopes of adding it to the office store.

I'm finding some of the documentation a little unclear because it doesn't quite make sense to me when it comes to licensing.

Why do I need to create a database and manage username, passwords and subscriptions? this seems contradictory to using Microsoft as a provider.

I had assumed that I would submit my app then a user would login with their office 365 account, pay for the app (or subscription) and my client would submit the users token through an API and I would get a response to say they are authorised for the resource I have provided.

I'm not sure what my responsibilities are. Are there any good videos on YouTube or Microsoft that give a good and simple walkthrough how this works?

Any help is greatly appreciated thank you.

Any plans to upgrade the sample(s) to .NET 6 (Core)?

.NET Core 3.1 Support ends December 13, 2022. It would be great if the samples were upgraded to the latest .NET 6 (LTS)

Also, adding code for SSO support (token from Excel client and OBO flow) in the Add-in web apps would be awesome -- maybe just Excel as an example.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.