How can I get the email body with a mobile Add-In - outlook-addin

I'm working on a mobile extension point for my Add-In.
I want to get the HTML contents of an email, from a taskpane.
On the desktop version of the Add-In, I call Office.context.mailbox.item.body.getAsync() from the taskpane javascript file, which works fine.
However, on the outlook mobile app for android, Office.context.mailbox.item.body is an empty object. Office.context.mailbox.item seems to have all the context about the conversation but not about the actual email.
How can I get the HTML body of the email from mobile?

For accessing body on Outlook Android, you will have to use Office.context.mailbox.item.body.getAsync(). Please find same snippet below:
Office.context.mailbox.item.body.getAsync("text",
function (asyncResult) {
if (asyncResult.status == "failed") {
console.log("Action failed with error: " + asyncResult.error.message);
} else {
console.log(asyncResult.value);
}
}
);

Related

Webview browser application not open the dynamic links of Google Forms either dynamically or directly

I built a Webview browser application on an Android 11 device that knows how to open all links perfectly! But it does not open the dynamic links of Google Forms either dynamically or directly (when I copy the final address that opens on my computer), the application completely crashes and closes! I did not find any useful information on Google only regarding dynamic links to Firebase - I added the functionality as required, but to no avail! For Dodge:
Dynamic: https://forms.gle/uJq3pGPJhqZGYzLC6
, Direct: https://docs.google.com/forms/d/e/1FAIpQLSd8PZt648GmhALFyykBTflSiU8b9_e-h3gVfY6ZBcF9-N0HbQ/viewform
Dynamic: https://docs.google.com/forms/d/e/1FAIpQLScnkyROLo8VavCmaRagZb6eiucxjCdkOs6blijHwe34vFXO6g/viewform?usp=sf_link ,
direct: https://docs.google.com/forms/d/e/1FAIpQLScnkyROLo8VavCmaRagZb6eiucxjCdkOs6blijHwe34vFXO6g/viewform
I tried to add dynamic links to the firebase SDK, and In AndroidManifest.xml, add an intent filter to the activity that handles deep links for your app. And I also called to call the getDynamicLink() in OnCreate() but the links never reached this event.
Direct reading ON 'shouldOverrideUrlLoading' didn't help either because the application crashes before it gets here, that is, something goes wrong with the dynamic search and even in debugging it disrupts the URL completely:
public boolean shouldOverrideUrlLoading (WebView view, String url) {
if(url.contains("https://docs.google.com/forms/") && url.contains("/viewform"))
{
try {
url= "https://"+ url.split("https://")[url.split("https://").length-1].split("viewform")[0].trim()+"viewform";
}
catch (Exception e)
{
Toast.makeText(MainActivity.this, e.toString(), Toast.LENGTH_LONG).show();
url = "https://www.google.com";
}
}
mWebView.loadUrl(url);
return true;
}

Is it possible to add a custom Cloud file service (like OneDrive/Dropbox) to Outlook.com (Office 365)

I've seen that when you add an Attachment in Outlook, you can automaticly add an attachment from a cloud service.
Is there a possible way to add a custom entry to this list?
I offer to you to use OneDrive file picker , with this you can simply add button to your add-in html and then it's open the log-in page and after user is log-in he could choose the files from one drive.
The steps wrote in the link but I write the main steps here:
1.register your app in Microsoft Application Registration Portal .
2.Add the js refrence in your js file of your add-in:
<script type="text/javascript" src="https://js.live.net/v7.0/OneDrive.js">
</script>
3.Add button to your add-in html page:
<button class="oneDriveButton" id="btnOneDrive" ><img src="https://js.live.net/v5.0/images/SkyDrivePicker/SkyDriveIcon_white.png" style="margin-right: 10px; height: 20px;">Open from OneDrive</button>
4.In your js file of add-in open the picker:
$('#btnOneDrive').click(function () {
var odOptions = {
clientId: "your client id from your app registration ",
action: "download",
multiSelect: true,
openInNewWindow: true,
linkType: "query",
advanced: { redirectUri: "your redirect uri from app registration" },
success: function (files) {
},
cancel: function () { /* cancel handler */
},
error: function (e) { /* error handler */
}
};
OneDrive.open(odOptions); });
Put attention:
Your clientId and your redirectUri must be equal to this you
set when you register your app in the first step.
You could change the option by what you want ,look here under
picker options .
Thats all , you get the files in sucess handler function and you could do whatever you want with them.
Good luck!

Worklight 6.1: How to add EULA to hybrid app

Environment:
Worklight 6.1.0.2
dojo 1.9.4
We have created a hybrid app using Worklight 6.1 for android, iOS and windows8 platform. Now we would like to add and show End User License Agreement (EULA) window to the user, when the app first time launch. It should have Accept and Decline button. If user tap on Accept button, then he should be able to use the app.
I would like to know, how can we achieve this using Worklight 6.1.
Any help on this, will be much appreciated.
FYI there is nothing specific here to Worklight.
You could implement this in any number of ways w/out ever using any Worklight API whatsoever.
You could achieve it for example like this (untested code - you'll need to experiment):
In main.js create some global variable eulaAccepted:
var eulaAccepted;
// You will need to handle this property using HTML5 Local Storage so that it will persist for the next time the app is launched, and have the app act accordingly.
Then, in wlCommonInit():
function wlCommonInit() {
if (!eulaAccepted) {
displayEula();
} else {
displayApp();
}
}
In displayEula():
function displayEula() {
// either display a dialog using `WL.SimpleDialog`...
// Or maybe custom HTML with "accept" and "not accept" buttons
WL.SimpleDialog.show(
"Eula Agreement", "your-eula-text-here",
[{text: "Accept", handler: acceptEula },
{text: "Reject", handler: rejectEula}]
);
}
Handle the result:
function acceptEula() {
eulaAccepted = true;
... // Some code that will store the `eulaAccepted` variable using HTML5 Local Storage API
displayApp();
}
function rejectEula() {
// Display some other custom HTML instead of your app.
// Maybe also additional logic to try again to accept the Eula...
}

Facebook FB.ui dialog iOS Web App unclosable

I have FB.ui working well, I can share whatever info I need to share. However the issue is that it's being rolled into a Web App (This "add to home screen") for an ipad. Whenever the dialog opens, it's opened full screen, and once it's shared there is no way to close the opened dialog.
<input type="button" onclick="share_prompt()" value="Share" />
function share_prompt()
{
FB.ui(
{
method: 'feed',
display: "iframe",
name: 'Facebook Dialogs',
link: 'http://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
message: 'Facebook Dialogs are easy!'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
I've changed the "display" property to everything possible, but the docs say that it defaults to a "touch" display in web apps.
Also, to make it even more frustrating, the response doesn't fire when in web app mode. Only in the browser window.
Any ideas?
This is the way I solved this:
if(navigator.standalone){
new_url = 'https://www.facebook.com/dialog/feed?'+
'app_id=XXXXXXXXXXXXX'+
'&display=popup'+
'&caption='+fbName+
'&picture='+fbPicture+
'&description='+fbDescription+
'&link='+fbLink+
'&redirect_uri=http://myurl.com/mycontroller/#post_id';
window.open(new_url,'_self');
} else {
//do the normal way
}
This way you can have a redirect url and you can send the post id back to your app if you need it. Hope this answers your question if you still didn't find a way to solve it.

Opening pdf files with the Trigger.io in-app browser?

I have a hybrid mobile app built on Trigger.io that opens links (some of them are user generated content) in the in-app child browser (forge.tabs module) per default. When trying to open a .pdf document the screen will stay blank white (tested on both Android and iOS).
Here is a cut down version of the code I'm using:
$(document).on('click', 'a', function() {
window.forge.tabs.open( $(this).attr('href') );
return false;
});
I would expect to either view the document in the in-app browser or be able to download it to the device.
Assuming your PDFs are local, you'll need to do a "getURL" first.
Here's a function that works just fine for me:
function showPDF (pdfName) {
forge.tools.getURL(pdfName, function (myPDF ) { forge.tabs.open(myPDF); });
}
Then just call showPDF with a relative or absolute url i.e.
<button class="btn" type="button" onclick="showPDF('assets/pdf/sample.pdf');">