Get MIME mail content in Outlook Addin via Graph - javascript

I am trying to create an outlook addin, that reads the selected mail in .MSG or .EML format. I found a
Stackoverflow Question with a link to this documentation how to read a mail from Graph: https://learn.microsoft.com/en-us/graph/outlook-get-mime-message. I tried to use https://graph.microsoft.com/v1.0/me/messages/{id}/$value with the Graph tester. I entered all ids i could find in the Office.context.mailbox.item but none of them gave me a valid result. So where do I have to take the id from, the Graph Tester needs?

I found that: Office.context.mailbox.item.itemId.replace('/', '-').replace('+', '_'); gets the same id, the graph gives when asking for all messages via https://graph.microsoft.com/v1.0/me/messages. I just do not know why I have to replace chars in the id.

Related

Not able to get full message body using Gmail API in JavaScript

There are many similar questions here, but none of them matches my concern.
I am giving the "FULL FORMAT" in endpoint, as mentioned in documentation, But still I get 1-2 lines of message body. I want to get all the text written in email. It gives me 25-40 words in "Snippet" key name in respond. How can I get the whole message?
Thank you!!!

Format messages from Slack

So I'm making request to Slack api to get messsage history of a particular channel. Everything works fine except the messages that are returned are still in slack format. Is there any way to convert it to HTML format?
Thanks.
No. The Slack api will give you the messages in Slack markup only. If you want them in html you need to convert them yourself or find a library.
Here is how to parse the Slack markup in order to convert it into another format like HTML:
If you're retrieving messages, we've included some extra details in
the sections above to help you parse the formatting syntax. This will
let you properly format it for display on a different service, or to
help your app fully understand the intent of a message. Here are the
general steps involved for detecting advanced formatting syntax:
Detect all sub-strings matching <(.*?)>
Within those sub-strings, format content starting with #C as a channel link
Format content starting with #U or #W as a user mention
Format content starting with !subteam as a user group mention
Format content starting with ! according to the rules for special mentions
For any other content within those sub-strings, format as a URL link
Once the format has been determined, check for a pipe (|) - if present, use the text following the pipe as the label for the link or
mention.
From official Slack documentation on Formatting.

Reading emails through javaMail library with Mirth Connect

My goal is to read emails(and possibly mark them as read in the inbox) through Mirth Connect channels. I found this Reading mail from open source Mirthconnect question about the issue. Oddly the person asking answered the question. When I tried to implement the code he provided with my specifications such as instead of gmail outlook inbox(no problems here) the channel called out error:
64DETAILS:
TypeError: Cannot find function getBodyPart in object <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi!</div>...(here the email continues with div tags)
So I clearly get the email data but getBodyPart breaks it. What I understood from this is that his code was meant for specific kind of emails and I guess I received an non-mime email in the example here.
So it seems what I am asking: How do I create a reader that translates all mail into plain text and then output it into the logger/other output so I can manage it?
Management would mean something like spreading specifically titled mail into different channels and mark them read in the inbox they came from.
I hope I'm clear enough with my question and follow the rules of asking questions.
I am answering to your updated query.This program will be reading the email repeatedly as you mentioned is correct so as to avoid this after reading you need to move the email to other folder and also you can customise your program to read from particular email sender or based on subject so that it reads only your particular email and you can move that email to you wished folder.
I was the one whom you mentioned in the code. When I tried to fetch the mail from GMAIL also I faced the same issue. But I checked the security apps OFF, I have provided the link here for GMAIL. I guess something like this must be available for outlook as well. But I have tried the same code to read in my outlook it worked fine without any changes been made (not sure how?).
For GMAIL Security OFF
https://myaccount.google.com/lesssecureapps
It depends on the kind of mail your are reading. In my case I was getting HTML designed data in the body of the mail.That code was not generalized one. It is supposed to read HTML data in mail body.I'm not sure how your mail is?. But mp.getBodyPart(0) or mp.getBodyPart(1) should provide some output. Even if you attach the file in the mail, mp.getBodyPart will read the attachment.

How to apply password prompt javascript on acrobat pdf

I have a pdf which needs a javascript prompt that would asks for a username and password or just one of these. I have tried the native javascript way inside the javascript editor of acrobat. Alerts work fine but prompts are not working for me.
var customerName = prompt("Please enter your name", "");
have also tried
var customerName = app.prompt("Please enter your name", "");
EDIT:
WEll i tried to remove the complex parts of the process so that you guys can understand better. but i guess i owe you guys some explanation on what i am trying to achieve.
Well i have an empty pdf which i am going to send to my users and when it is opened it will ask for a username/password which is then submitted to my website through an api. I already have an api in place which would check for the correct credentials and on success would print the desired pdf content on a php page, which could be grabbed as a curl request through the javascript inside the empty pdf. And when i want to revoke the access to the user i would just delete the user from the database on my server. So the next time he wants to read the pdf he wont be able to pass through the api security.
Well i know there are some drawbacks on applying so many restrictions like pdf reader compatibility etc. but even if it only works on acrobat that would be fine. Later on will try to remove the print and save options etc.
Most of the parts are done the only thing i am stuck at the moment is on how to send a form GET request to a url. I think js prompt doesn't work in acrobat so i guess i have to send the data through an acrobat form. Any one knows how can i send a get request through the forms or get the values of input boxes in javascript?
Thank you everyone, i just found out on how to post data to a webpage. Here is the link,
Can a PDF fillable form post itself to an HTTPS URL?
Instead of choosing "PDF the complete document" from the format options, choose html.

Using Google Spreadsheet as JSON file using tabletop to datatables returns error

I'm a relative newbie when it comes to coding, especially javascript. I currently am trying to populate a table from a google spreadsheet, which will update when the spreadsheet is.
I followed this tutorial word for word (basically all you need to do is replace the key with your own to specify your spreadsheet, and make sure its both published and public, which I've done)
http://dataforradicals.com/the-absurdly-illustrated-guide-to-sortable-searchable-online-data-tables/
I just get a bad request 400 error referring to my spreadsheet. If I visit the spreadsheet generated directly I just get the words...
"Invalid query parameter value for sq."
https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&sq=&callback=Tabletop.callbacks.tt140241226993949106
I can visit my spreadsheet with the link I was given when I published it here..
[maximum links reached but the structure is different]
As you can see the domain structure is different. I fear that "Tabletop to Datatables" is adding an outdated url to the start of that link but can't find where it actually applies it.
The only reason I would think thats not happening is because the example in the tutorial still works! And the link it refers to is the old style URL too
I'm baffled, please help if you can. All suggestions appreciated
The query string includes a parameter without a value, &sq=.
https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&sq=&callback=Tabletop.callbacks.tt140241226993949106
^^^^
Try this, with that parameter completely removed...
https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&callback=Tabletop.callbacks.tt140241226993949106
There is an updated version of this project. Any necessary updates are included here:
https://github.com/scottpham/tabletop-to-datatables
Try with the updated versions of all js libraries.
Check the link and remove the extra string after pub. That part of link is not necessary and may cause issues.
According to google:
The 400 Bad Request error is an HTTP status code that means that the request you sent to the website server, often something simple like a request to load a web page, was somehow incorrect or corrupted and the server couldn't understand it.
Good luck

Categories

Resources