简体   繁体   中英

Upload annotation into Dynamics 365 using Kingswaysoft

I read a list of zip files, each one of them have one pdf file inside. For this reading I use a script component in a SSIS package. Once I read the pdf file I want to save a binary version of it in a sql server table. The column that stores the documentbody is VARBINARY(MAX) type.

This is the code I use for the reading an encoding part:

        {
            using (ZipArchive Archive = ZipFile.OpenRead(Row.documentpath))

                foreach (ZipArchiveEntry Entry in Archive.Entries)
                 {


                    if (Path.GetExtension(Entry.Name) = "pdf")

                         {


                        using (StreamReader r = new StreamReader(Entry.Open()))

                            FullFile = r.ReadToEnd();
                            byte[] arr = System.Text.Encoding.UTF8.GetBytes(FullFile);

Next I have a Kingswaysoft component that reads this table, where each row is a different file, and load them into Dynamics.

Everything goes without errors but when I go and check the annotation entity, I open the pdf file and it's empty, blank pages inside.

I believe it is something related with the encoding part. Could you help me?

In this case, we suggest using our SSIS Productivity Pack instead of the script component. With the Compression Task , you can decompress the files, then use our Premium File System Source Component to read the extracted PDF files and write them to the annotation entity using our CRM Destination Component .

If you require any further assistance, do not hesitate to reach out to our support team.

Getting empty pdf attachments when trying to create "activitymimeattachment"

I found a solution through this post:

I changed the typo of the arr variables to var . I really don't know why it didn't work before, but now it does.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM