I am trying to create an Outlook Add-in, but have a problem.
The Office library returned an error when I called Office.context.auth.getAccessTokenAsync running on Outlook for the desktop.
But when I run this program on the web version (Office365) it is working without problems.
How to get AccessToken on Outlook for the desktop?
Office.initialize = function () {};
function testfunction(event) {
Office.context.auth.getAccessTokenAsync(function (result) {
if (result.status === "succeeded") {
//...
}
})
}
Error:
code:13003
message:The identity type of the user is not supported
Using Outlook 2016 (15.0.9126.2152) on Windows 10 Pro.
From the documentation:
13001
The user is not signed into Office. Your code should recall the getAccessTokenAsync method and pass the option forceAddAccount: true in the options parameter. But don't do this more than once. The user may have decided not to sign-in.
This error is never seen in Office Online. If the user's cookie expires, Office Online returns error 13006.
With Outlook, in particular, you will see this using an Outlook.com account (MSA isn't currently supported). You may also get a 13001 if you're using an on-prem Exchange Server without "modern auth" enabled. If this is the case, you will need to enable modern auth to resolve the error.
Please note that your desktop Outlook 2016(15.0.9126.2152) is the MSI (non-subscription) version. getAccessTokenAsync is not supported on that version.
Related
I am working on web-bluetooth to connect a Web-App with BLE device. I have the connections now, I am looking how can I unpair a device.
I have looked into the official web-bluetooth documents
https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getdevices haven't find much about it.
Can anybody suggest something on this?
Thanks
What a coincidence! I am currently working on adding a new forget() method on BluetoothDevice so that web developers can revoke permission access to a paired BluetoothDevice.
// Request a Bluetooth device.
const device = await navigator.bluetooth.requestDevice({ acceptAllDevices: true });
// Then later... revoke permission to the Bluetooth device.
await device.forget();
Spec PR: https://github.com/WebBluetoothCG/web-bluetooth/pull/574
Chromium CL: https://bugs.chromium.org/p/chromium/issues/detail?id=1302328
Note that this experimental functionality is currently available in Chrome 101 and requires users to enable the chrome://flags/#enable-web-bluetooth-new-permissions-backend flag.
You can try my sample at https://bluetoothdevice-forget.glitch.me/
I want to get contact list from Android(If user open website in android). I was searching on it little bit. I found two question in stackoverflow similar to this.
Obtain Contacts Permission before Navigating (Cordova)
Listing phone contacts using javascript
Cordova
Here what I tried.
function onSuccess(contacts) {
alert('Found ' + contacts.length + ' contacts.');
};
function onError(contactError) {
alert('onError!');
};
// find all contacts with 'Bob' in any name field
var options = new ContactFindOptions();
options.filter = "Bob";
options.multiple = true;
options.desiredFields = [navigator.contacts.fieldType.id];
options.hasPhoneNumber = true;
var fields = [navigator.contacts.fieldType.displayName, navigator.contacts.fieldType.name];
navigator.contacts.find(fields, onSuccess, onError, options);
I didn't get any error or alert message in android. When I visit the webpage in PC I got an error
Uncaught ReferenceError: ContactFindOptions is not defined
at contacts.php:17
I think I am having error cause, there's no contact function in PC.
I am so beginner in JS. I think Cordova must be installed in PC, I am not sure of the information also. If I have to than how can I install Cordova? I am using Debian Based Linux Distro. So, I tried
sudo apt-get install cordova
But,
E: Unable to locate package cordova
Are you building a mobile app with Cordova or are you just running your code in a website on Android?
If it’s just a website: you simply can’t do what you want since the browser doesn’t provide an interface to the contact list.
Unlike a Cordova app, which has access to the system APIs, among them the contact list API, JavaScript Code executed in a mobile browser, cannot access such APIs. The browser JS API simply provides no way.
JavaScript code run inside a Cordova/Capacitor mobile app however can Cordova APIs which bridge the mobile’s native API to JavaScript.
I am trying to build an OTP autoread in web. I read Chrome provides OTPCredential (here). But the check 'OTPCredential' in window fails on every mobile chrome browser I am trying even when the version is greater that 84. Have they removed the support now?
Check out navigator.credentials, it returns a Promise resolved with the one-time password (code) when the device receives the OTP SMS message containing the requesting URL and the code:
navigator.credentials.get({otp: {transport: ['sms']}})
I'm trying to modify the content of the clipboard by executing the "copy" command on a focused DOM element. However, the new content comes from the server, and arrives from a websocket, which is then processed in a callback that does not come from direct user interaction.
Because it wasn't triggered by the user, it is not allowed to do such thing as modifying the clipboard content, as specified in the Firefox's MDM website . The error message is:
document.execCommand(‘cut’/‘copy’) was denied because it was not
called from inside a short running user-generated event handler.
To overcome this issue, the same page suggest to request permissions to the browser throught navigator.permissions.query():
navigator.permissions.query({name: "clipboard-write"}).then(result => {
if (result.state == "granted" || result.state == "prompt") {
/* write to the clipboard now */
}
});
However, thought the article they use different names for the permissions:
clipboard-write
clipboard-read
clipboardWrite
clipboardRead
Within the same site, the permissions article shows a browser compatibility table , where it says Firefox supports clipboardWrite from version 51 and clipboardRead from version 54.
The problem is that none of these permissions is working on Firefox (I'm using Firefox 63). The query callback is never called. I have tried the four permission names without any luck.
To make sure the mechanism was working, I tested other permissions, such as notifications which worked flawlessly (It showed "prompt")
navigator.permissions.query({name: "notifications"}).then(result => {
alert(result.state)
});
So my question is: Am I doing something wrong when requesting the permissions, or have this permissions changed whatsoever?
It is intentional, aka. by design in Firefox. They chose to not expose this API to WEB content, only for browser extensions.
See here and more specifically here for your reference:
We do not intend to expose the ability to read from the clipboard (the Clipboard.read and Clipboard.readText APIs) to the web at this time. These APIs will only be usable by extensions...
I'm writing a Chrome App using the chrome.bluetooth Javascript API and PNACL. I can turn on Bluetooth discovery, find devices, connect, and communicate successfully. But I cannot figure out how to pair a new device programmatically from my app.
There are Windows and Mac system APIs for this; is there an equivalent on ChromeOS?
Use the chrome.bluetooth API to connect to a Bluetooth device which works only on OS X, Windows and Chrome OS. All functions report failures via chrome.runtime.lastError.
You may make your chrome app connect to any device that supports RFCOMM or L2CAP services and that includes the majority of classic Bluetooth devices on the market.
As detailed in Chrome - Bluetooth, there are three things you need to make a connection to a device:
A socket to make the connection with, created using bluetoothSocket.create
the address of the device you wish to connect to
the UUID of the service itself.
Sample code implementation:
var uuid = '1105';
var onConnectedCallback = function() {
if (chrome.runtime.lastError) {
console.log("Connection failed: " + chrome.runtime.lastError.message);
} else {
// Profile implementation here.
}
};
chrome.bluetoothSocket.create(function(createInfo) {
chrome.bluetoothSocket.connect(createInfo.socketId,
device.address, uuid, onConnectedCallback);
});
Please note too that before making the connection, you should verify that the adapter is aware of the device by using bluetooth.getDevice or the device discovery APIs.
More information and sample code implementations can be found in the documentation.