Insert HTML in displayNewAppointmentForm Office.js - outlook

I've been working on a Office.js add-in that automatically generates some text depending on a few previously saved settings. This text is editable.
I'm using CKEDITOR v4.14 for the rich-text editor. However, when I click "Planlegg møte" (Plan meeting), the text itself is pasted into the displayNewAppointmentForm object as plain-text, HTML tags and all. No conversion is happening.
Upon closing the dialog box, I'm creating the new appointment by caling the following after closing the dialog and before completing the button click event:
dialog.close();
dialog = null;
setTimeout(() => {
Office.context.mailbox.displayNewAppointmentForm({
location: 'https://' + settings.data.domain + '.easymeeting.net/' + settings.data.number,
subject: 'Easymeeting videomøte',
requiredAttendees: [],
optionalAttendees: [],
resources: [Office.context.mailbox.userProfile.emailAddress],
body: settings.data.message,
});
}, 500);
btnEvent.completed();
btnEvent = null;
I also tried setting the body by calling Office.context.document.setSelectedDataAsync after initializing the new appointment form but it seems very little is happening on the Outlook client on PC.
Is it possible to insert a message as HTML or otherwise formatted (with newline "\n" for example) in the displayNewAppointmentForm body?

You are able to use special characters such as \n and \t, however HTML is not possible today. We track Outlook add-in feature requests on our user-voice page.
It looks like the feature you want has been requested by others already. Please upvote the existing request displayNewAppointmentForm. Feature requests on user-voice are considered when we go through our planning process.

Related

Google Spreadsheet script refresh table inside a ModelessDialog

So i'm trying to create a "search box" using a "ModelessDialog", the main idea is as follow
1) User runs a macro that pops a ModelessDialog with the following fields: autocomplete, search button, and table (empty, only with headers)
2) The "Autocomplete" field is where the user can type an "ID" , (this part is already done)
3) The idea is, When the ID is selected, press the "Search" button to run some other macros in the background, then returns the data needed to populate the table and refresh the current "ModelessDialog"
The idea of doing it this way is that i dont want to open / render a whole page, as i want to be as fast and without having to "jump" between windows
Any advice? (im not adding any code since i don't have any trouble with the rest of the code /html, as the autocomplete auto populates, and the button runs the macro and returns some data)
Also im kind of new in javascript and html (I followed tutorials to make the other parts work :D )
The client-side JS code that resides in your modeless dialog can call server-side functions via google.script.run. The server functions can fetch the data required for filling the table, perform string interpolation and return an HTML string to the client.
Just set the callback function for google.script.run to modify the contents of your table received from the server.
Modeless dialog HTML
<div id="myTable">
<table>
<!-- table contents -->
</table>
</div>
JS script for the dialog:
google.script.run.withSuccessHandler(function(html){
var tableContainer = document.getElementById("myTable");
tableContainer.innerHTML = html;
}).getTableData();
More on client-client server communication here
More on templated html here

Slack: How can I remove a message's action buttons without Slack appending "edited"

I have a Slackbot message that has action buttons (see here). When a user click's a button, we perform a bit of work on our server and then use chat.update to remove the action buttons and update the message's footer:
removeButtons(reply, convo, footer) {
const data = reply.original_message;
delete data.attachments[0].actions;
data.channel = reply.channel;
if (footer) {
data.attachments[0].footer = footer;
}
this.bot.api.chat.update(data, (res) => {
});
}
Everything is working great but Slack appends an "(Edited)" to the message. I see a lot of other apps doing the same, but they seem to avoid the "(Edited)" text? What are they doing differently?
I've tried setting as_user and replace_original in the chat.update call but haven't had any luck.
Slack Screenshot
There are two ways to "update" a message as result of an interaction.
Use the API method chat.update (as you described)
Respond directly to the slack request with a new message
With 2) the original message will be replaced by default and there will be no "edited" note.

iFrame tabbing within frame/pop-up window

As shown in the following example, I would like to restrict the tab key behavior to just this frame with links.
http://jsfiddle.net/zFXNM/
tabindex ="1"
I do NOT want the tab to go the URL other items in the browser.
For example, the "Compose Mail" in Gmail does this already. I observed 3 usages of "tabindex=-1" within the JS.
In pure JavaScript, I have figured out a solution for this issue. The idea is whenever the page is loaded we determine the first and last links, then we prevent the tab default action and jump to the first link from the last tab.
if (activeElement.id == lastHrefID) {
e.preventDefault();
document.getElementById(firstHrefID).focus();
}
A working solution is available at : https://jsfiddle.net/srirammac/95sv63s7/

System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client

I have a telerik radscheduler. I make appointments on it. To add an appointment I have date boxes and a radeditor. On the radeditor I have entered text like this "my test link". I made the word link as a hyperlink (pointing to some link on the internet). I have a submit buttton that adds the appointment. WOrks fine. I click to edit the appointment.Edit it and now save it and it gives me this exception "System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client ". I put validaterequest="false" and it works,but I am reading it is not safe/correct way. How do i proceed?If you need info,please ask.Thanks
It seems like you pass HTML to a field you later edit with a simple textbox, so such an error is expected. Perhaps where you use a RadEditor to get HTML, you should not.

How to open and handle richtext editor in javascript in sitecore 6.5?

I've been working on a custom field, which contains a list.
I have to be able to edit the selected item on the list in a richtext editor. (this is the only missing part).
I've read the topic on opening from c# code Opening Rich Text Editor in custom field of Sitecore Content Editor .
This works nice for the "add" button, since i have to open the RTE empty(with default text...), but not for the Edit button.
My aproaches are:
Somehow in the Edit button's message field list:edit(id=$Target) pass the selected index (like list:edit(id=$Target,index=$SelectedIndex), but i don't know how to populate $SelectedIndex
Somehow in the overridden HandleMessage method get the list's selected index. I'm able to get the selected value Sitecore.Context.ClientPage.ClientRequest.Form[ID of list], but thats alone not much of a help, since i won't be able to decide which one to edit if two listitem equals.
Do the richtext editor opening and handling fully in javascript. As i saw at some script in content editor, i tried to do that, but i can't understand it clearly:
richtext editor url:
var page = "/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx";
some params :
var params = "?da=core&id&ed=" + id + "&vs=1&la=en&fld=" + id + "&so&di=0&hdl=H14074466&us=sitecore%5cadmin&mo";
and the part where i'm not sure:
var result = scForm.browser.showModalDialog(page + params, new Array(window), "dialogHeight:650px; dialogWidth:900px;");
This way the RTE opens as expected (i guess i could get the selected index from javascript and pass it as a parameter later). However when i click ok, i get exception from EditorPage.js saveRichText function: Cannot read property 'ownerDocument' of null. Am i missing some parameter?
Either of the three aproaches is fine for me(also i'm open for new better ones) as soon as i'm able to do it.
Thanks in advance!
Tamas
I was able to enter some javascript into the message:
list:Edit(id=$Target,index='+document.getElementById(ID of the select using $Target ).selectedIndex+')
this way i got the index in HandleMessage.
I'm waiting for better solutions now.

Resources