How to differentiate UI controls between O365 and Outlook? - outlook-addin

How can I define different UI controls and text for the same add-in between Office 365 (online) and Outlook (native on your machine)?
For example on Office 365 online we want the add-in button to be in a new dropdown, on Outlook in a new button group.
How can this be achieved?

#Michael Heuberger currently, there's no way to define different UI controls and text (labels) for the same add-in between the Outlook Web App and the native Outlook Desktop client. Kindly submit a feature request to our UserVoice page : https://officespdev.uservoice.com/

You could have two different views in your Add-in - one for Web and one for desktop. To achieve this define a following jQuery function:
function detectPlatform(platform) {
if (platform == "OfficeOnline") {
$('#WebView').removeClass('display-none').addClass('display-block');
$('#DesktopView').removeClass('display-block').addClass('display-none');
}
else {
$('#DesktopView').removeClass('display-none').addClass('display-block');
$('#WebView').removeClass('display-block').addClass('display-none');
}
}
and call it inside $(document).ready of Office.initialize like: detectPlatform(Office.context.platform);
In your HTML you could have 2 div containers with different UI elements:
<div id="WebView">Web UI</div>
<div id="DesktopView">Desktop UI</div>
Obviously you also have to define used CSS classes (display:none and display:block). If you don't want to use jQuery you can achieve the same with pure JS of course.

Related

Multiple Windows In ASP.NET Core Blazor

I am learning Blazor from a WinForms background. In Winforms I used to create a new form perhaps on a click of a button to display some info or a map then drag it to a second monitor.Can I achieve the same with a blazor app. I see many tutorials on dialogs but I believe that I am correct in thinking that this is not what I am looking for in that you cant move a dialog to diffrent part of the screen or 2nd monitor?
Blazor is a web app technology, so you can't break out of the context of the tab (or tabs) in the same way that you can with WinForms by opening a new form, even dialogs will remain inside the context of the current tab.
I would suggest the following:
Use JS Interop to open a new tab targeting the component that you want opened separate from the current location
Drag that tab onto another monitor.
#inject IJSRuntime JSRuntime
public async Task OpenInNewTab(string url)
{
await JSRuntime.InvokeAsync<object>("open", url, "_blank");
}

How to add a menu items for tiles menu in W10

How to add a menu items for tiles menu in W10 using UWP? Preferably through xaml
Feature allowing custom menu items is called jump lists and it works both on live tiles and on the task bar buttons. The best way to learn about it is from the official sample on GitHub and from Docs.
A very simple jumplist could be created like this:
var jumpList = await Windows.UI.StartScreen
.jumpList.LoadCurrentAsync();
jumpList.Items.Clear();
JumpListItem sampleItem = JumpListItem
.CreateWithArguments("item", "Do something");
jumpList.Items.Add(sampleItem);
If you want to display recently opened files (as is the case in the screenshot), you must create a file extension association for your app and store accessed files in the Most recently used list. This can be found here and is managed using the Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList class.

.innerHTML does not work on Windows Phone browser

I have a problem with a label field on my HTML page. I have set a label as below:
<label id="labelid" class="required control-label">Old Label Value</label>
Based on some other form input, I am trying to change the value of the label using javascript. The code for that is:
function change()
{
document.getElementById(labelid).innerHTML = "New Label Value";
}
For some reason, this works fine on a desktop browser. It also works fine on IOS and Android phones. But when i view this HTML page on a windows phone browser, the new value is not visible.
Please advise. I must be doing something silly, but i cant figure it out.
The basic objective is to update a label based on what the user has typed in a text field. Please let me know if there is another way of doing it instead of using labels.
Try this code. You didn't have quotes around labelid..
function change() {
document.getElementById("labelid").innerHTML = "New Label Value";
}
In reference to Windows phone browser, Mark Chamberlain had these comments to a similar issue:
"Standard Javascript injection is not enabled; most likely due to risk of attacks, web site spoofing etc. If you need to customize a web site that you own, you should implement your changes on the web site (server) side."
This could possibly extend to adding/deleting/modifying HTML is my interpretation.
From this link: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/94d4a806-3eca-411e-adda-9e0fa8a6f467/how-to-inject-or-insert-the-javascript-code-in-webbrowser-windows-phone-7?forum=wpdevelop

How To create Custom Action

I want to create one custom action such that on that custom action page one button is available,on that button event i want to show hello word on same custom page
Custom Actions generally are used to link to Application Pages which will do the work.
You can include customactions to the Ribbon, to context menus (ECB), or to the Site Settings pages (as well as Central Administration).
The custom action will typically be a custom section with a link to an application page, and within that page you will perform whatever logic you require. You can pass tokens through to the querystring by enclosing them in parenthesis { } such as <UrlAction Url="/_layouts/MyApplicationPage.aspx?ListItem={ItemId}" />
Here's a link to a tutorial on how to create a custom action to appear in the Site Settings page. Google around for simliar tutorials on how to get a custom action to appear in other areas, such as the Ribbon or the ECB.

SharePoint 2010: custom masterpage for programmatically created subsites

What’s the best way to add a custom masterpage to a subsite that is being created programmatically in a feature event receiver? Each of these 50 subsites gets its own “_catalogs/masterpage”, so I have a feeling that Elements.xml for the root-site’s Module/Elements.xml is out. More feature receiver code? PowerShell post-deployment processing?
Is this going to be 50 copies of the same Master Page?
If not, I can't really picture how the Master Page will be specially made using code, but also a Feature Module element is certainly out.
But if it is 50 copies of the same file, you could deploy the Master Page to the Gallery one time using a Feature Module element. Then in your Feature Receiver, make a copy of that file with a new name in the Master Page Gallery and attach it to your website:
web.MasterUrl = "_catalogs/masterpage/custom_v4.master";
web.CustomMasterUrl = "_catalogs/masterpage/custom_v4.master";
web.Update();
You might want to think about creating
custom site definition.
You have following choices to set master page for the site:
1) Using Sharepoint Browser UI (from Site Settings page)
2) Using Custom site definitions
3) Programmatically
4) Using SharePoint Designer
Looking at your scenario, no 3 is an option. You may want to do it in the Feature Receiver itself.