The Office.context.mailbox.item.conversationId in Outlook add-in returns undefined - outlook-addin

I tried to use conversationId in the Outlook add-in, but I am getting undefined. In the documentation it was given that I would not get the id for a new message but I tried to retrieve the id from an existing thread but was returning undefined. Any idea why the Id is undefined
Office.initialize = function (reason) {
$(document).ready(function () {
var conversationId = Office.context.mailbox.item.conversationId;
});
}
EDIT:
I am on a Windows computer and using Chrome version Version 70.0.3538.110. The output of mailbox item :
{"_data$p$0":{"_data$p$0":{"extensionId":"xxxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx","marketplaceContentMarket":null,"permissionLevel":3,"marketplaceAssetId":null,"entryPointUrl":"https://localhost:3000/index.html","consentMetadata":null,"endNodeUrl":null,"hostVersion":"2018112401.04","owaView":"mouse","timeZoneOffsets":[{"start":-8640000000000000,"localStart":-8640000000000000,"end":8640000000000000,"localEnd":8640000000000000,"offset":330}],"userDisplayName":"Anto Joy","userEmailAddress":"outlook_xxxxxxxxxxxxx#outlook.com","userTimeZone":"India Standard Time","userProfileType":"enterprise","ewsUrl":"https://outlook.office365.com/EWS/Exchange.asmx","restUrl":"https://outlook.office365.com/api","itemType":4,"isRead":false},"_permissionLevel$p$0":2}}

Related

Pouchdb query() leaving out documents on emit()

For some reason my filter is not working correctly. It was working fine a moment ago and then for some reason it stopped returning all of the templates and only started returning one of them.
Why might it be returning it twice but only giving me one?
I have the following code:
export async function testMe() {
const company_id = await AsyncStorage.getItem('company_id');
const device_db = new PouchDB(company_id, {});
device_db.query(function(doc, emit){
console.log(doc.type, doc._id, doc._rev);
if(doc.type == 'template') {
emit(doc._id, doc);
}
}).then((result) => {
console.log("Returned", result);
})
}
What is unexpectedly happening is this is what gets returned:
template template_1 18-5918af4c5370d9755d0bb8b6dcb21ea1
template template_2 19-8191dec49dfa8c1a2f03d752a193f09e
template template_3 39-74f3b82ce4a38a501810b5ff31efc593
undefined "dpbcab6843-2cdf-4d4c-87ae-286dcddaac22" "2-8f03f3127771dadd3c8f7beb3e827982"
undefined "dpdc6f6cd0-6c6d-4974-a166-b848a0217af4" "2-0eec1a8d925641aa8bf30e058e6515e7"
undefined "dpe1573a70-a281-4e15-a997-82d8bf8fabfa" "2-d3bbcb81344f61cc94459610695c6670"
template template_3 39-74f3b82ce4a38a501810b5ff31efc593
You can ignore the undefined, but what I am trying to show is look at what gets returned twice:
template template_3 39-74f3b82ce4a38a501810b5ff31efc593
In the Returned console.log(), this is the only thing that gets returned (the last template_3 piece of data, totally ignoring the other templates even though they are both type template):
{"total_rows":6,"offset":0,"rows":[{"key":"template_3","id":"template_3","value":{..}}]}
Edit
It's getting even weirder. I just opened template_2 and did a save (in Cloudant) and synced it with my device to update the _rev and now I get:
template template_1 18-5918af4c5370d9755d0bb8b6dcb21ea1
template template_2 20-c549fe868735ef0099b80f6668af611c
template template_3 39-74f3b82ce4a38a501810b5ff31efc593
undefined "dpbcab6843-2cdf-4d4c-87ae-286dcddaac22" "2-8f03f3127771dadd3c8f7beb3e827982"
undefined "dpdc6f6cd0-6c6d-4974-a166-b848a0217af4" "2-0eec1a8d925641aa8bf30e058e6515e7"
undefined "dpe1573a70-a281-4e15-a997-82d8bf8fabfa" "2-d3bbcb81344f61cc94459610695c6670"
template template_3 39-74f3b82ce4a38a501810b5ff31efc593
template template_2 20-c549fe868735ef0099b80f6668af611c
Which returns (leaving out template_3):
{"total_rows":6,"offset":0,"rows":[{"key":"template_2","id":"template_2","value":{..}}]}
Edit 2
I added:
.catch((err) => {
console.log(err);
})
And get this: {"status":409,"name":"conflict","message":"Document update conflict","error":true}
However, I do the following an all _conflict arrays are empty:
device_db.allDocs({conflicts: true})
.then((data) => {
for (let d of data.rows) {
console.log(d.doc._conflicts);
}
});
I believe temporary queries like this should have a key, otherwise the query would not know what documents you want to select. The example from the PouchDb docs is
db.query(function (doc, emit) {
emit(doc.name);
}, {key: 'foo'}).then(function (result) {
// found docs with name === 'foo'
}).catch(function (err) {
// handle any errors
});
so that documents with a "name" field equal to "foo" are returned by the query. In your query the key appears to be undefined. This might explain the odd results you are getting?

The Office.context.officeTheme property is undefined

The property Office.context.officeTheme is undefined when used in the Outlook application: Official documentation. In Word, Excel and PowerPoint, the property is defined and I can access its children properties (bodyBackgroundColor, controlForegroundColor, etc...). I tried with both latest (1.1.0.13) and previous (1.1.0.12) versions of Office.JS but it doesn't work. My outlook version is: 1711 (Build 8730.2127) and I also tried in the latest insiders build. Sample code:
Office.initialize = function (reason) {
$(document).ready(function () {
// The "Office" object and its "context" property are valid but the "officeTheme" property is undefined.
// This works in Word, Excel and PowerPoint but not in Outlook.
if (!Office.context.officeTheme) {
console.log("Office theme not loaded");
}
});
}
Per information received from the product team, Outlook does not currently support the office.context.officeTheme property. Thanks for pointing out this problem with the docs (and for logging the corresponding GitHub issue as well). We'll update the docs to reflect that Outlook does not currently support this property.

office.context.mailbox is undefined

when i am trying open a pop up in outlook.i am getting office.context.mailbox undefined in pop up controller.But i got office object in controller.Please suggest.Code is below
(function() {
'use strict';
angular.module('wpoffice')
.component('externalTrack',
templateUrl: 'app/components/externalTrack/external-track_template.html',
controller: ExternalTrackController,
bindings: {}
});
​
/** ngInject*/
​
function ExternalTrackController($rootScope, $scope, $timeout, appData, ngNotify,$q,trackingService) {
var self = this;
self.$onInit = activate;
function activate() {
console.log(Office)
console.log(Office.context.mailbox);
}
}
})();
You can't access most functions in a pop up launched by the dialog API and I see no reason it would work if you used window.open either.
The messageParent function is one of only two Office APIs that can be called in the dialog box. (The other is Office.context.requirements.isSetSupported) Dialog API docs

Unable to find element and send keys

So just a brief overview, I'm unable to send keys to a edit text field for android. I've successfully sent keys to this element via browser but in order to test the mobile application fully, I'd like to run e2e tests on a device using Appium.
I've successfully got Appium to click button elements but am having a hard time getting it to send keys to an edit field element.
Am I able to find elements by model when testing with android as I have set in my forgot-pin-page.js?
pin-reset-page.js
var pinResetPage = function() {
describe('The Reset Pin Flow', function () {
forgotPinPage = forgotPinPageBuilder.getForgotPinPage(),
describe('The Forgot Pin Page', function () {
it('should allow the user to enter their MSISDN and continue',
function () {
forgotPinPage.enterMsisdn('123123123');
forgotPinPage.doForgotPin();
expect(securityPage.isOnSecurityPage()).toBe(true);
});
});
}
forgot-pin-page.js
'use strict';
var ForgotPin = function () {
var forgotPinPageContent = element(by.id('forgot')),
msisdnInput = element(by.model('data.msisdn')),
return {
enterMsisdn: function (msisdn) {
return msisdnInput.sendKeys(msisdn);
}
};
module.exports.getForgotPinPage = function () {
return new ForgotPin();
};
The error i'm getting is
? should allow the user to enter their MSISDN and continue
- Error: Timeout - Async callback was not invoked within timeout spe
cified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Not sure if this is the correct solution but it worked for me. I downgraded jasmine2 to jasmine and that seemed to resolved the async timeouts I was having.

CRM 2013 JavaScript Form Reload on attribute onChange crashes on IE9/10/11 but works on Firefox & Chrome

I am having an issue to reload the Form after a field Onchange is triggered. The issue happens only with Internet Explorer.When I change the compatibility mode with developer tools to 8 It works but 9/10/11 it crashes.
Things I have tried.
xrm.utility.openentityform.
window.location.reload
window.location = document.url
function SaveAndRefresh() {
var id = Xrm.Page.data.entity.getId();
Xrm.Page.data.save();
Xrm.Utility.openEntityForm("incident", id);
}
Any help will be appreciated
Thanks
Try using:
Xrm.Page.data.refresh();
You'd still call save, so you're code would look like:
function SaveAndRefresh() {
Xrm.Page.data.save();
Xrm.Page.data.refresh();
}
Well, according to the SDK, you could do:
Xrm.Page.data.save().then(
function () {
alert('Save worked, refresh');
Xrm.Page.data.refresh();
},
function () {
alert('Save failed!');
}
);