I have an Outlook Add-ins to automatically insert signature.
With desktop client, manifest.xml refers to only 1 javascript file, so I need to put everything in 1 single file.
However, I want to reuse some of the function it contains in the taskpane, which use another set of Javascript files.
Is there a way to create a common.js file that would be included everywhere?
Thanks
You can create a JS file specifically for automatically inserting the signature, and then include that file in the HTML for the taskpane. Just ensure that this javascript file only contains ES6 code, and mainly API calls that you want to be shared between the signature insertion and the taskpane parts of your add-in. Also, include it in the taskpane HTML file, after the taskpane JS file.
Alternatively, it is OK to have 2 separate files here to avoid accidentally breaking one part of your add-in when you make future updates to it.
Related
I want to ask if Office JS is allowed to save local files?
In old question/answers I found various solutions like
FileSaver.js
Download2.js
I tried both but it did not help.
Both are using the technique of embedding a download link in the HTML document dispatching the event programmatically using JS. But click event fails with error = Access is denied
I want to ask if
Office JS API is allowed to create files to local path?
if NO was it allowed in older versions?
If YES do I need to make some configuration changes on Windows 10 desktop PC?
If allowed Please help how to achieve that
I want to create an XML file using JavaScript and save it to local path
thanks
I add content with my Outlook mailitem, but the signature is sometimes at the top, sometimes it is at the bottom, so when I click the signature buttons in the picture, I want to take the content of the signature and add it to the bottom.
Signatures are kept on the disk. By default you can find the Signatures folder in the following location:
C:\Users\%username%\AppData\Roaming\Microsoft\Signatures
If you want to backup just a single signature, look for the following files and folders;
<signature_name>.htm - This file is used when creating HTML messages.
<signature_name>.rtf - This file is used when creating Rich Text messages.
<signature_name>.txt - This file is used when creating Plain Text message.
<signature_name>_files - This folder is used to store supporting files for your signature such as formatting, images and/or business cards (vcf-files).
So, you may read the signature files and detect where it has been added in the email.
With VS 2012, Web Essentials, TypeScript 0.8.3
There is a TypeScript file "test.ts". It is compiled into "test.js", having a sourceMappingURL at its end.
//# sourceMappingURL=test.js.map
The Javascript file is loaded dynamically with $.getScript. However, when in Chrome Developer Tools I cannot find the source anywhere, so a breakpoint cannot be set.
If I manually edit the generated Javascript by appending a sourceURL, the situation improves.
//# sourceMappingURL=test.js.map
//# sourceURL=test.ts
The name "test.ts" is offered in Chrome in the Sources tree. However, clicking on it opens the Javascript file "test.js". There breakpoints can be set and used.
Actually it does not matter, whether the correct name "test.ts" or any other name is coded.
What should be done, so debugging a TypeScript file, whose generated Javascript file was dynamically loaded, is possible with Chrome?
I also tried Canary. It made no difference.
I am writing to affirm what WhyMe wrote. Appending tag to using jQuery.append() does not add filename to sources tree, but using DOM element to .appendChild DOES add filename to sources tree.
var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", 'Scripts/app/Views/Management/Spock.js');
document.getElementsByTagName("head")[0].appendChild(fileref)
Spock.js will be in the correct folder in Sources tree.
Using //# source=Path_to_file works, but
A. must have the pathing correct, and
B. filename appears under <No Domain>; which is really ugly.
PS - I do not have 50 reputation points, so I cannot reply as a comment next to WhyMe's comment, but I can add an Answer?
Working in Chrome Canary (25.0.1364.172 m), and using require.js to load scripts dynamically, I can set and use breakpoints on the typescript files:
NB that this only works on code which matches some JS output - so (logically enough) you cannot set a breakpoint anywhere inside an interface definition.
I'm not sure if using require.js for your on-demand script loading is an option. If so, it should fix your problem.
$.getScript would probably load the file using xmlhttp and adding the javascript later to the DOM thus the browser cannot map the javascript to the js breakpoint
Requirejs adds a script tag with a src attribute so the browser can still hit the breakpoints
I'm building a component that sends email messages in certain situations. I would rather not have the email HTML directly within my php code, therefore I would like to put the html into a .inc file. I'm not sure if best practices dictate where such files should be placed...the media folder perhaps? Thanks in advance!
The intent for the /media/ directory is that it contains all the assets you need to be "web visible" for your component. So if your component displays images, uses custom CSS, JS file etc that's where they would go.
The point of the media directory is so that in future updates to Joomla! the core code files can be moved to a non-web visible location to improve overall security.
Having said that if you will have executable or sensitive content in your .inc files then I would create a asset directory within the /administrator/components/com_yourcomponenet/.
Using VS2010, creating a new MVC 4 Web API project. Just wondering, can the .js-files in the Script folder be deleted, or are they somehow related to the magic beneath? How about those cshtml- files in the Views folder, I can't see that they are necessary for a REST-service, or again, are they part of the underlying technology. My guess, it can all be deleted safely - but just to be sure...
Bonus question (while I'm here): recommendations for unit- and integrationtesting REST-services, got any?
Thank you.
If your project only exposes a series of WebAPI controllers then that implies that your project will never serve actual HTML-based content. Thus, you can safely delete all files related to that content, such as:
HTML files (.cshtml)
JavaScript files (.js)
CSS style sheets (.css)
Images (.jpg, .png, .gif)