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.
Related
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.
I created a set of logic apps to have a very specialized integration between D365 CE (CRM) and SharePoint. I am using the Notes entity in CRM to allow the user to upload a docx file using the native CRM UI. The Logic app finds the file (using CRM List Items action) and returns the file as a base64 encoded string. I was able to view the Logic App execution logs to see the base64 string and I was able to successfully decode it and open it in Word so I know that much is working perfectly.
The problem is when I try to create or update a SharePoint document using LA Create File or Update File actions. The file that results in SharePoint has the correct name, but I get an error when I try to open the file using Word (any version). I inspected the docx file before uploading to CRM and downloading from SharePoint and there is some differences in the bytes between the files - my guess is that something is not handling a Unicode conversion somewhere. In this picture, you see the PK signature (thanks Phil Katz) of the docx appears in the first two bytes and several other strings appear, but (what I think is high-order characters) is not converted correctly (the original file on top, and after downloading from SP on the bottom):
A few more technical details...
I tried to use a base64toBinary() in the logic app to upload the file to SharePoint:
and since the UI is hiding the actual expression, the code for this action looks like this (see line 5):
The problem is that either the base64toBinary() is not returning a faithful representation of the file, or the Create File is not happy about getting a docx file as binary as a parameter. I have tried passing the original base64 string directly to SP, but it just stores it as base64 and requires me to download/convert it before I can open it, and yes, I have tried using base64toString(). I have also tested the process with a plain text file, and that works just fine.
I am using D365 v8.2.2 and O365 SharePoint.
Naturally, after posting a question to the world and then getting a good nights sleep, I found the answer. The problem is in the JSON notation that the Designer generates. In my code above, you see where I used the base64toBody() function. I realized that it had curly braces around the entire function which turned the binary file into an object. By removing the braces, the file is now passed to SP as a binary correctly:
"body": "#base64toBinary(items('For_each_file_attached')?['documentbody'])",
So if you want this to work, I had to use the Code View in the editor to make it correct. I would be interested in knowing if there is a way to do the transformation from base64 to binary between retrieving it from CRM and before using the Create File action so that it could be more OOTB Designer.
I'm building a PHP application that uses data from a web service. I add an image to a desktop application which then saves it to the web. The web service provides image URLs using the .ashx file extension. If I put one of these in an <img src="file.ashx?pictureId=abc123">, it displays as an image.
I want to store these images. I know they'll generally be .jpg files and can run file_get_contents on this and save it as such. However, if one was a .png, for example, I'd still be saving it with a .jpg extension, so it's an assumption I don't wish to make.
I've had a look at the raw string of characters of the file and cannot see any identifying features to tell me that it's a .jpg, apart from perhaps the clue that it was created in Photoshop. Nowhere does it say what kind of file it was originally, either extension or original filename.
Is there a way of finding the original filetype of a file contained within .ashx URL?
The question doesn't make any sense. Maybe the .ashx script generates the image on the fly out of nothing and there is no "original".
The correct question is: how to find the type of the image retrieved from the .ashx URL?
Save the image into a (temporary) file then use getimagesize() to find its type (GIF, JPEG, PNG etc) and choose the correct termination for its final file name.
In my Silverlight project, images for which the source URI does not contain the file extension don`t display, although the documentation says it should.
I set the image source like so:
imgCompanyLogo.Source = new BitmapImage(new Uri(Application.Current.Host.Source, "/Files/" + logoName));
Now, if "logoName" contains the file extension (like ".png" for example), the image is displayed fine, but it simply doesn't if the file is stored without an extension.
This seems to contradict the documentation here which states:
"The format-specific filename extensions such as .png are not necessarily required to be in the URI naming, but if the retrieved file is not determined to be a valid image format, a runtime exception is thrown."
I'm not getting any runtime exception either.
Is this a known issue or am I missing something simple?
Thanks!
PS: Just a little twist, the images display fine while debugging, not when the system is deployed...
I've made some test and the problem seems to be due to the response from the server.
If you try using .png within your project with a Build Action sets to Resource, both images will load regardless the extension.
Now if you try with images hosted on a server, it won't have the same behavior. Actually, if you try to browse the link to an image without extension directly in your browser, it will result in something else. On Chrome it will download the file, and on IE it will display the result as plain text.
That's because of the MIME type. A png should be returned with the type image\png.
There is a trick with .htaccess to set up the MIME-type but you need to have to specify for which extension. It works like this:
AddType image\png yourExtension [Extension2] [Extension3] ..
And if you want to see if why the image didn't load on your Image control, you can add an eventhandler to the ImageFailed event:
<Image Source="..." ImageFailed="Image_ImageFailed" />
But the error message that you will see is not really helpful:
ErrorException = {System.Exception: AG_E_NETWORK_ERROR}
By default when you add an image (icon, bitmap, etc.) as a resource to your project, the image's Build Action is set to None. This is done because the image is magically stored inside a .resources file.
I want the resource to be stored as an embedded resource (my reasons are irrelevant, but let's just pretend it's so that I can see them inside RedGate's Reflector).
So I changed each image's Build Action to Embedded Resource, and the resource then appears inside Lutz's Reflector - exactly as I want.
Unfortunately, Microsoft says specifically not to do this:
Note that when the resource editor
adds an image, it sets Build Action to
None, because the .resx file
references the image file. At build
time, the image is pulled into the
.resources file created out of the
.resx file. The image can then easily
be accessed via the strongly-typed
class auto-generated for the .resx
file.
Therefore, you should not change
this setting to Embedded Resource,
because doing so would include the
image twice in the assembly.
So what is the proper way to include an image as an embedded resource?
Note: This answer is not the recommended way of handling image resources. It just addresses the particular problem as described by the question (i.e. to include an image as an embedded resourse).
Don't add the image as a resource. I would rather do the following:
Create the image/icon and save it to a file
Choose Project -> Add Existing Item and add the file
Set the Build Action to Embedded Resource
You can then access this resource using
Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceUri)
This way the image is not magically added to the projects resource file and you will only have one copy of the image stored in the assembly's resources.
In the project view, open the Properties subtree; double-click the Resources.resx item.
(If you don't have one, right-click the Properties item and choose Open, then click on the Resources tab on the left, and click the link in the middle of the page to create a default resources file.)
click the first droplist at the top of the resources.resx page. It probably says something unhelpful like "Strings", and select Images. Alternately you can press Ctrl + 2. This changes to the Image resources view. Now click the Add Resource droplist and choose 'existing file'. Select your image file and click Open. Rename the resource if you like.
Click the Save icon.
You can now access your embedded resource programmatically as:
[namespace].Properties.Resources.[yourResourceName]
In VS 2005:
Right click on your project and
choose add new item.
Add a resource file. Call is
myImages.resx
Place this file in the root folder of the project.
Right click on myImages.resx
and choose View Designer
Select Add Resource, Add Existing
file.
Browse for the image e.g. stop.bmp
This image does not have to be included in the project at this stage. The resource file will automatically do this.
To reference the image in code use something like:
btnStop.Image = myImages.Stop;
This depends on how you want to use the image.
If you want to localize and access specific images for a specific culture, then using the ResourceManager is a good way to go because it provides some nice functionality for satellite assemblies, searching, fallbacks, etc.
If you just want to embed a resource in an assembly and aren't worried about localization (using Assembly.GetManifestResourceStream) then just adding a image and setting the build action to Embedded Resource is fine.
The documentation warns you about not setting the build action to Embedded Resource because the resource is already compiled into the assembly by the resource compiler via the .resx file.