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.
Related
I am trying to read a PDF as text, and I can write it back with junk in it, which is fine as I have a parser component to get the bits I need.
My question is how can I read specific parts of the PDF and ignore the rest?
If your PDF is well formatted, you can do it using text scraping, but that means you need to open the PDF file and it must be visible for Native Scraping to work
Need to add a set of information to a pre existing PDF file on Visual Studio
Basically Where to begin ?
Situation Description: I have a form from a company, I need to print data from a database to the PDF file programmatically. That's to say, my current system (a webservice) must generate a full formed PDF from pre-existing file with the data it recives from the client.
Why edit the PDF file ?
The PDF is part of a set of documents from a survey, and must retain is original layout with no variations.
I'm creating a small Windows application (C++) which create some windows an such (CreateWindowEx and the like). And in one window I want to add a control that shows MHTML loaded from memory, i.e. the whole MHTML content is in a string, not in a file.
I already tried the Shell.Explorer component, but I can't find a way to inject to it anything other than HTML (see AtlAxCreateControl).
Is it possible to use the Shell.Explorer component or any other to show in-memory MHTML??
That is, without writing the content to a file and then giving the file path. That works, but it's not optimal and it'll have to be the last alternative if I can't do it any other way.
PS: If this can be done in another language or environment like C#, JS, VBS, WSH, HTAs, I'm all ears as well.
A bit late to answer, but still - there is a way to do it : use Microsoft's WebBrowser control (COM component, can be used in .Net apps as well).
Take a look an what the proposed solutions here - How to load mht from stream/string into a WebBrowser control? and here - How to display the string html contents into webbrowser control?. some of them refer to mhtml content but the solutions are applicable to ordinary html files as well.
Good luck.
I have tried to find out the way I can put locks or disable the copy and paste on the PDF file after the conversion. I looked at the ConversionJobSettings properties but I couldn’t be able to accomplish this.
Based on what I have read, the sharepoint2010 Word Automation services API provides very limited capability in manipulating the conversion logics but is there any way I can lock down the content so that it cannot be copied?
Thank for your help
You will either need to code something up yourself or get a third party product such as this one, which allows conversion as well as PDF manipulation including security and watermarking.
Note that I worked on this product, so I am obviously biased. Having said that, it works brilliantly.
The only way to prevent copy and paste (as text) is to create image versions of the pages and saves those as a PDF.
a possible solution:
1) Use Word automation to print to a PostScript (PS) printer driver to get a .ps file
2) Use GhostScript to convert the PS to tif files
3) Create a PDF using the tif files (possibly with GhostScript too)
I am currently writing an application working with specially prepared image data. Another tool prepares the images (basically PNGs with additional data stored in the meta-data section). Now my tool works with these files, but not with all PNGs, so "we" decided to use a different file extension. So far, so good.
Now, because I am a lazy sack I implemented some file type registration to allow double-clicking on the file and opening it in my application (no problem at all).
And here is my Question:
It would be cool if the windows explorer could still show me the thumbnail previews for my files. Since they basically are still PNG files, it should be possible without writing my own shell extension (at least I believe so).
I quickly tried to copy all registry keys and values from HKCR.png to HKCR.mInDat (my file name ext) and it worked. However, I would prefere knowning what I am doing ;-)
Which of the registry settings are responsible for the thumbnail preview control and which can I use to get the preview for my file types?
I tried to google it, but I failed, since it seems I am unable to come up with the right buzz-words to find the info I need. Please, help me.
Thank you!
Yours,
3of4
Simple:
[HKEY_CLASSES_ROOT\.apng]
#="apng"
"Content Type"="image/png"
"PerceivedType"="image"
[HKEY_CLASSES_ROOT\apng\shellex\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
#="{3F30C968-480A-4C6C-862D-EFC0897BB84B}"