Office.context.mailbox.item.addFileAttachmentAsync The code worked correctly. Why an internal error has occurred? - outlook-web-addins

Previously the code worked correctly. Why an internal error has occurred?
Is this a problem with the JavaScript API for Office?
https://learn.microsoft.com/en-us/outlook/add-ins/add-and-remove-attachments-to-an-item-in-a-compose-form
The link and title are correct. I checked it out.
var options = {
asyncContext: null
};
Office.context.mailbox.item.addFileAttachmentAsync(link, title, options, function (asyncResult) {
console.log("asyncResult: " + JSON.stringify(asyncResult));
if (asyncResult.status === "succeeded") {
$docName.prepend("<i class='ms-Icon ms-Icon--checkbox ms-font-m ms-fontColor-green'>");
$fileProcess.resolve();
} else {
console.log("Office.context.mailbox.item.addFileAttachmentAsync() [" + asyncResult.status + "] error: "//
+ JSON.stringify(asyncResult.error) + " value: " + JSON.stringify(asyncResult.value));
$fileProcess.reject();
$attachedDoc.addClass("ms-bgColor-error");
$docName.prepend("<i class='ms-Icon ms-Icon--alert ms-font-m ms-fontColor-error'></i>");
$docName.after("<div class='ms-ListItem-tertiaryText addedError'>" + asyncResult.error.message + "</div>");
}
});
I got an asyncResult:
asyncResult: {"value":null,"status":"failed","error":{"name":"Internal Error","message":"An internal error has occurred."}}

The problem was with a self-signed certificate.

Related

Invalid or unexpected token at new Function of Enumerable using linqjs

I want to return an object using Enumerable of linqjs. But this code gives an error "Invalid or unexpected token". When I check the same condition using if condition in forEach then it is working perfectly. But what's problem with Enumerable?
Using Linqjs
var checkAddressForUpdate = Enumerable.From($scope.companyAddresslist).Where("$.Address === '" + $scope.ad_CompanyAddress.Address + "' && $.SlNo !== " + $scope.ad_CompanyAddress.SlNo).FirstOrDefault();
Using If Condition
var checkAddressForUpdate;
angular.forEach($scope.companyAddresslist, function (comAddress) {
if (comAddress.Address == $scope.ad_CompanyAddress.Address && comAddress.SlNo != $scope.ad_CompanyAddress.SlNo) {
checkAddressForUpdate = comAddress;
}
});
Error in console
enter image description here

Phonegap barcode prompts to enter value

Am using phonegap-plugin-barcodescanner in a phonegap app to scan QR codes.
When firing the scanner using:
function scan() {
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
}
The camera doesn't start - I just get a prompt saying:
"Enter barcode value (empty value will fire handler)"
Any ideas welcome TQ
The prompt says "Enter barcode value (empty value will fire handler)" maybe because you run platform browser. I' ve got the same "problem" when i run my project with "cordova run browser", and "browser" is a platform installed.

ontouchstart event not working on Android default browser

I am firing an event using ontouchstart. It is working on other Android browsers like Firefox and Chrome (desktop too), but it is not functioning on the default Android browser.
Here is my code:
gauge.node.ontouchstart = function (e) {
e.preventDefault();
$.get("/varigate/zone/" + zoneId, function(zone) {
$.get("/varigate/crop/" + zone['cropId'] + "/name", function(cropName) {
var capitalized = cropName.charAt(0).toUpperCase() + cropName.slice(1);
deletePaddock();
history.pushState(null, "Irrigation of Field " + paddockId, "irrigation/id=" + paddockId);
switchToPage('gauge', irrigationPlan, paddockId, capitalized, zone['label'], currentFarm);
});
});
};

Protractor running tests on PhantomJS

I can't seem to get PhantomJS through a test successfully. I tried to integrate it into my project, but after that failed I tried to just run the basic Angular Docs samples and I'm getting the same issue. My steps so far:
npm install -g phantomjs
phantomjs --webdriver=9515 // ... GhostDriver - Main - running on port 9515
protractor protractorConf.js
This is the same file from the example with only browserName, and seleniumAddress port changed:
// An example configuration file.
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:9515',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'phantomjs'
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['onProtractorRunner.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
}
};
I get the following error message:
UnknownError: Error Message => 'Detected a page unload event; asynchronous script execution does not work across page loads.'
I found this issue on github, which seemed to be related. I thought I had made enough sense of their brower-setup.md to include it in one of my beforeEach functions. Then I found here ptor is just wrapping the driver anyway. Wow, I know I'm a noob here in protractor/selenium land, but the signal to noise ratio is intensively dissuasive. I'd really like to get the performance benefits of using PhantomJS, but the prospect of losing several more hours on this is hurting my head. I'm on Windows 7 Enterprise 64-bit, in case that matters. Thanks!
Acutally this fix was solving the same issue for me:
https://github.com/pschwartau/protractor/commit/1eeff8b1b2e3e8f3b7c8152264411f26d4665a07
As originally described here: https://github.com/angular/protractor/issues/85#issuecomment-26846255 by renanmartins
Inside protractor/lib/protractor.js Replace
this.driver.get('about:blank');
this.driver.executeScript(
'window.name = "' + DEFER_LABEL + '" + window.name;' +
'window.location.href = "' + destination + '"');
with
var driver = this.driver;
this.getCapabilities().then(function (capabilities) {
if (capabilities.caps_.browserName === 'phantomjs') {
driver.executeScript('window.name = "' + DEFER_LABEL + '" + window.name;');
driver.get(destination);
} else {
driver.get('about:blank');
driver.executeScript(
'window.name = "' + DEFER_LABEL + '" + window.name;' +
'window.location.href = "' + destination + '"');
}
// Make sure the page is an Angular page.
driver.executeAsyncScript(clientSideScripts.testForAngular, 10).
then(function(hasAngular) {
if (!hasAngular) {
throw new Error('Angular could not be found on the page ' +
destination);
}
});
});

NodeJS : outputting a string using Express EJS Template

I have a code where on error I return a status with an error message:
if (err){
res.render('page1', {status:2, msg:'Server Error : Probable unable to connect'});
return;
}
In my page1.ejs, I have coded the following way:
var status = <%= status %>;
alert ( 'The status = ' + status);
if( status == 2)
{
var msg = "'" + <%= msg %> + "'";
alert(msg);
}
OR
if( status == 2)
{
alert('"' + <%= msg %> + "'");
}
I am trying to get the value of status and msg - but since 'msg' exists as multiple words I am not able to find a way to capture complete strings as passed from NodeJS. Firebug shows error as:
SyntaxError: missing ) after argument list
alert('"' + Server Error : Probable unable to connect+ "'");
-------------------|
Try this:
alert('<%= msg %>');
I am not an expert for EJS, but maybe this could work var msg = <%= msg %>; alert(msg);? Or simply alert(<%= msg %>)?

Resources