Outlook Plugin SSO + onSend sample - outlook

It's been several days that I am struggling trying to create an Outlook plugin that enables SSO and that is triggered on a send event.
I am using the Yo Office generator for the SSO sample and I followed this sample for the OnSend Event.
As they are both constructed from different manners, I have difficulties to make them work together.
SSO sample uses Webpack and OnSendEvent sample uses ReScript.
Steps to construct the SSO Sample:
yo office --projectType single-sign-on --host outlook --name sso-sample --js
cd sso-sample
npm install -save office-addin-sso#latest
npm run configure-sso
Then I did a merge between the SSO sample and the OnSend sample and I run npm start
Steps I did to merge the two projects :
Merging the manifest file.
Adding app.js + index.html + app.css
inside the src folder Modifying the webpack.js file
Here is the error I am getting :
Here is my code.
Do you have an example that combines SSO and OnSend Event ?
Extra steps I did :
I trusted the localhost certificates generated by the SSO Sample.
I enabled the onSend Flag
Thank you for your time and your help :)
Wish you a good day.

I have found from where the problem where coming from.
I have updated my code repo with a sample that works.
Source of the issue :
Trying to get the bootstrap token from the wrong place.
I need to call the method directly from the validatebody method.
Regards,

Related

How do I include my Swagger Hub API definition in a project deployed on Heroku?

I have written the logic for a backend e-commerce REST API, and I have documented it here:
https://app.swaggerhub.com/apis-docs/chris-larham-1983/e-Commerce_Registration_Customers_Addresses_Orders/0.1#/. I would like to include this specification in my project that is deployed on Heroku so that the project and documentation are in one place.
I have configured the Heroku database, populated the 'customers', 'orders', 'products', and 'addresses' table with sample data, and the specified endpoints are working as specified in the document - for example, https://codecademy-e-commerce-rest-api.herokuapp.com/api/products.
So far I have tried downloading the documentation from within my Swagger Hub account in 'html', 'html2', and 'dynamic html' formats, as I thought I would just include a .html document in my project. However, these downloaded documents do not closely resemble the documentation as linked above; the formatting is very different and does not look as professional.
Does anybody know I could include my Swagger Hub API definition in my project so that the documentation and project are both hosted on Heroku?
Thanks in advance for any help/pointers to tutorials.
After a couple of hours of searching and configuring, I have solved this problem thanks to an npm package called swagger-ui-express. This package can be found here: https://www.npmjs.com/package/swagger-ui-express.
I downloaded my API specification in the format JSON resolved and added it to my project as a file named swagger.json. Then I followed the configuration information in the swagger-ui-express documentation, uploaded to heroku, and it worked!
The lines of code I added in index.js were:
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
I hope this helps somebody in the future :)

How to get Rest Api endpoints, name and url's, in the way Azure Functions do?

Sometimes you get over a feature that you just like. When creating a Azure Function project and debugs it, it writes out this nice info in the console.
Now that I am writing the frontend, I have found this information very useful.
Functions:
CoWorkers: [GET,POST] http://localhost:7071/api/CoWorkers
GetManager: [GET,POST] http://localhost:7071/api/GetManager
SetManager: [GET,POST] http://localhost:7071/api/SetManager
UserInfo: [GET,POST] http://localhost:7071/api/UserInfo
...
I would like to have this on every asp.net rest api project that I am coding.
Anyone knows how to get it?
EDIT: OpenApi/Swagger is providing this information as pawelek91 says and I should have mentioned that I want it in the console: "Just because I like that feature".
use HttpOption request or swagger (if you can install it on your backend)
For console access to your web API, try the new HttpRepl tool at:
https://learn.microsoft.com/en-us/aspnet/core/web-api/http-repl/
It's a dotnet CLI tool that is installed separately (install using dotnet tool install -g Microsoft.dotnet-httprepl from the CL). Then you can "browse" your API using this command line tool.
As noted in the docs, it requires .Net Core 2.1+.

Generate Report in Plugin (Dynamics 365)

i gust curious maybe someone heard about solution how to get Report (SSRS Report) in Plugin (i want to export it in pdf from CRM and save in Sharepoint).
I have tried following solution:
https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/247210/how-to-run-the-crm-report-through-sdk?pifragment-97030=1#responses
this one is not working anymore because of authentication. I tried to authentificate my user in WebClient inside plugin but no luck. Maybe someone know how to do it
There is an excellent article/blog posted by Bob Guidinger for Generating Report and sending Email for D365 Online.
Once you get first step running, you can extend it to perform you specific operation.
Blog mentioned about Azure function and plugin (combination).
Scheduling Reports in Dynamics 365 - Part 1
I tried this for one of my project and it worked fine with me. This shall be a bit learning curve if you do not know how to create azure functions and some small parts.
Happy Coding!!
Make sure to upvote, Accept if this helps!!

How to download excel (.xls) file from API in postman for suite run?

For Single request,I can able to download the response output in excel format by chose an option 'Send and Download'. Can anyone help me to download the same using collection runner in postman.
This feature is not available in Postman Collection Runner yet! However, there is a workaround if you would like to do it in Newman.
As Newman is built on Node.js, you can extend it in a Node.js code as you can see in the below example.
https://github.com/postmanlabs/newman/issues/413#issuecomment-316116450
Running the script above essentially does the same thing as newman run ... and also saves the responses to files

Meteor Npm-module client-side?

Is it possible to use Npm-Modules on client-side?
More specifically:
I want to use node.js built-in crypto-module for encrypting a password the user enters and then send the encrypted password with a signature(/hmac) to my server.
I need to do it that way, because I must be able to retrieve the original password server-side, because afterwards I'm going to send it to a ldap-server, because the user should authenticate with the same username/password he is registered with on that server.
This is what I did:
created in packages/crypto/:
-package.js:
Package.on_use(function(api) { api.add_files('crypto.js',['server','client']);});
-crypto.js:
crypto = Npm.require("crypto");
It works fine on the server, but on the client it says "Reference Error: Npm is not defined".
So, is it possible to use the crypto-module on client-side?
Are there any alternatives for achieving this goal?
Thank you!
Edit:
Is there any good alternative for getting the password to the server in a secure way, so that the server can retrieve the original password?
I think doing the ldap()-request on the client-side (like:
if(checkLdap(usrname,password)){<login>} else{fail}) can be easily bypassed?
You can try to add the js-files you need on client-side from .npm folder under crypto's package directory.
So, your package.js file might look like this:
Package.describe({
summary: 'Description of your crypto package'
});
Npm.depends({
'crypto': '1.0.0'
});
Package.on_use(function (api) {
api.add_files('crypto.js', 'server');
api.add_files('.npm/node_modules/crypto/crypto.js', 'client');
});
You can use https://github.com/elidoran/cosmos-browserify now to archive this. I used wrapped packages before and it was real pain to update them and to create new ones. Now with browserify support I can include library with just several lines of code. See their example how to do it. I don't publish it here as it may be subject of change.
Its not possible to use Npm modules on the client side since Npm modules are extensions via node.js which only runs on the server end.
If you want to use a file like crypto you would have to make a client side only version and put it in /client/lib of your Meteor app
While this may be possible officially, Meteor doesn't support this.
You would have to include requirejs manually using this project: https://github.com/apendua/require
You can use browserify to build a .js bundle with all all the Npm modules you want on the client side. See:
2013 Meteor NPM Packages

Resources