Microsoft addins, get properties from manifesto dynamic settings - outlook

I'm developing an Outlook add-in and I need to store a base URL that will be called to perform an action. I need that this URL can be configurable.
My idea was to save that URL in the manifest.xml but I can't find a way for the adding to get it. I can't find anything related in the Office object (Office.js).
Example:
<bt:Urls>
<bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html"/>
<bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/>
<bt:Url id="Base.Url" DefaultValue="https://my-base.net/" /> <---- this
</bt:Urls>
Maybe this is not the right way...

You can specify the default URL in the add-in manifest and save the new data in the local storage of your add-in. See Persisting add-in state and settings for more information.
But there is no trivial way at present for an Office Add-in to read its own manifest. However, you can load it in JS if you know the exact place where it will be hosted. It is just a file on the web server.
So, I'd suggest avoiding the manifest file for data settings nowadays. It acts like your add-in's metadata. Instead, keep the strings hardcoded in the add-in and store in the settings or local storage the new value.

Related

Teams Toolkit: read configurableProperties and add a custom configurable property

We need to "Customize our Teams app" (https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/design/enable-app-customization).
Is it possible to read configurableProperties from "Manifest schema for Microsoft Teams" (https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema) using Teams Toolkit (for React) after an admin changed a property (e.g. websiteUrl) in our app?
And can I add custom configurable properties in the manifest?
Sincerely,
Maxim.
I don't know if these are readable from your app, but in any case you can't add your own. In addition, admins can't just change -any- property, only those listed in the page you linked (https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema). This means, for instance, that they can't change the websiteUrl for your tab - your app will always render from the web url you supply. Admins can only basically change things that affect the 'branding' of your app (like the name, logo, descriptions, etc.). The 'website' settings here are things like the privacy policy, etc.

Can the Outlook addin Javascript file get information from manifest file?

I am working on an Outlook addin and we are evaluating to see if we can pass information from manifest file to the Javascript API callback.
Ex : we need some port information to be available in the manifest and this should be passed to the Javascript API callback on ItemSend.
Is there a way for this ?
I'm sorry but there is no way for JavaScript in your add-in to read its own manifest at runtime.
Like Rick mentioned, OfficeJS doesn't provide any straight mechanism for getting the manifest file content.
But you may consider your manifest file as any other file xml file hosted on the server, so you can read its content like any other file, of course, it is hosted on the web server somewhere (with your web application).

Is there a way to connect database table with dropdown list in work item for Azure DevOps Server

I need to read content from table and show it in dropdown list in some work item type. The only way I managed to do it is to directly enter it in task.xml and it stays fixed like:
<allowedvalues name ="something">
<listitem value="something" />
<listitem value="something2" />
<listitem value="something3" />
The point is to be "dynamic" because the values changes weekly
So picture bellow demonstrates the current way of adding listitems that are fixed:
The easy answer: no.
The more elaborate answer: there is a custom work item control that can be linked to a REST API. So if you expose the database table through a REST API, and configure this custom work item control for the field.
Available extensions:
https://marketplace.visualstudio.com/items?itemName=ottostreifel.vsts-rest-multivalue-control
Or you could build your own custom work item control and publish that as an extension to the marketplace. Anything the browser can access can be used to extend that UI.
Note: These custom controls work only in the Azure DevOps web UI. Excel and older versions of Visual Studio rely on a WinForms implementation for similar behavior. Nor will the client/server verify that the value must be one from your REST API, it will treat the field effectively as a simple string without validation. This means that any API based access will be able to write arbitrary values to that field.
Alternatively:
Use a trigger or a job to generate the WIT xml and push it to the server using witadmin.

What is required to make a downloadable song?

I've just finished some courses on html and css, and am moving on to learning other languages. But as of yet, I don't know any other languages at all.
I'm learning to code to build my music website.
The most important thing to me is for people to download the songs I put up on the site.
I'm not asking for the code to do this. I want to know what is required so that I can learn how to do it.
I don't want people to download it simply by right clicking on the file and saving it. I want them to click on the link and their browser starts downloading it.
I've tried to search on forums and youtube and on this site, but what I've found is either not what I wanted or is beyond my understanding.
So, I'd appreciate a simple guide in what to learn to be able to create a link where, when someone clicks on it, the browser is prompted to download the audio file.
Here's my HTML. I've labeled where I plan to put my download link.
<table>
<tr><!--Off The Grid-->
<!--Song Title --> <td>Off The Grid</td>
<!--Audio File --> <td>
<object width="200px" height="15px">
<param name="src" value="../audio/off_the_grid_michael_pitluk.mp3">
<param name="autoplay" value="false">
<param name="controller" value="true">
<param name="bgcolor" value="#ffffff">
<embed src="../audio/off_the_grid_michael_pitluk.mp3" autostart="false" loop="false" width="75px" height="40px" controller="true" bgcolor="#ffffff"></embed>
</object>
</td>
<!--Download Link--><td>Code for a button to download the song</td>
<!--Social Media --><td>
<ul>
<li>Fill in with Tweet button</li>
<li>Fill in with FB share button</li>
</ul>
</td>
</tr>
</table>
The way the server sends the file, and the way the browser is configured to use it depend on the action that the browser will take. The link itself has no input on this.
You need to look at mime types, and how they're used within HTTP Headers.
By way of example:
I click on a link to www.example.com/song.mp3, my browser sends a request to the server.
The server sends back the file with a http header saying content-type: audio/mp3
My browser looks to see if it has anything that can deal with that file. If it does, it may play the file directly. (This is what happens for html, and pictures)
If the browser is unable to find a handler then it may prompt you to save the file (or perhaps just start saving the file automatically).
To force the 'download' behavior, you can either configure the server to send a mimetype that the browser won't handle automatically. This approach can generally be done on a server configuration level. Note that you have no control over what the browser does, and some browsers may still try to handle the file anyway.
Alternatively, you can send the file as an attachment, if you set the content-disposition header, like Content-Disposition: attachment; filename="song.mp3". This approach generally requires some form of code (eg php, asp.net, ruby, etc) to do this behaviour.
Your website should have a file called .htaccess in the site's "root directory" (the root directory is the folder that contains all the rest of your site's files). Assuming your site is running on an Apache server, if there is no such file then you should be able to add one. Just name the file .htaccess and place it inside the same folder where index.php or index.html lives (the root directory).
After that, inside your new .htaccess file, you can add something like this:
AddType application/octet-stream .mp3
... which will force all .mp3 files to be downloaded rather than played in the browser.
There are other methods, but they depend on the language your site is written in. If it's strictly html though, this is the only option I can think of.
Hope that helps... Let me know if you need me to clarify anything. :)

Retrieve the user response saved in a file in an app hosted on Cloudbees

I have hosted a Tomcat application on CloudBees which allows users to edit some XML and saves them. I need to download and save these files locally for my personal usage. However I could not find a way to do this. I tried the 'download source' option but it downloads the original files that I had uploaded and not the edited versions. However my application is able to access the edited versions (and so clearly everything is being saved all right). Getting these files back is extremely critical and necessary for me and is, in fact, the whole motive of this app. Kindly tell if there is some way to get back the files in CloudBees or any other free Java hosting site which would allow me to do it.
It's not very clear from your question how your app is currently dealing with these files, but I'll take a swing at providing some general info.
To support editing and downloading of files, your app design would need to address the following issues:
How do users edit/upload the changed XML?
Where does your app store the changed XML?
How does your app retrieve the edited XML and make it available for download?
For #1, you will need to provide an edit or upload interface in your app for manipulating the XML files. I'm assuming this is something your app has already solved using a form of some kind.
For #2, you need to pick an approach for storing the files that is appropriate for app's needs and the runtime environment where your app will be deployed. For instance, on CloudBees (or most other CLoud platforms), it's important to understand that the local filesystem of the app can be used for temporary storage, but it is not clustered and it will be wiped away each time the app is updated or restarted. If these XML files need to be available forever, you will need to store them in a persistent location that is external to the application's runtime instance. Most developers use databases (such as the CloudBees MySQL service) to store persistent data in this way. In general, your app can store these files anywhere, but your app needs to manage how to store them, and how to retrieve them later.
For #3, to allow a user to download the changed files, you will need to implement your own mechanism for retrieving the file from its persistent location, and then send it back to the user's browser. If you want something like right-click "Save As" to work, then your app will just need to support a URL that can display the edited XML file directly in the browser. If your app then provides a link to that URL, users can download it using RightClick+SaveAs. If you want the user to be able to click on a button/link and trigger a Save As dialog automatically, then you'd need to write a URL handler (Servlet) that serves the XML content up using a Content-Disposition header (see this StackOverflow article). This header will tell the browser that the file is supposed to be saved to disk, and allows you to provide a default file name.

Resources