From 923bf892a7f23e460b7c59fc260e4ef86939383a Mon Sep 17 00:00:00 2001 From: Christian van der Geer Date: Fri, 26 Jul 2024 15:25:03 +0200 Subject: [PATCH 1/3] feat: added retrieval of file type fields - Extracted retrieval of note attachments to separate function - Introduced isAttachmentPdf member to determine PDF type once per file - inverted conditional logic on isAttachmentPdf not to use negation - Added function to retrieve any file type fields. Quickest way to prevent large code refactoring was to convert the file blob to Base64 string - Bumbed version to .2 --- AttachmentGallery/ControlManifest.Input.xml | 2 +- AttachmentGallery/index.ts | 69 +++++++++++++++---- .../src/Other/Solution.xml | 2 +- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/AttachmentGallery/ControlManifest.Input.xml b/AttachmentGallery/ControlManifest.Input.xml index 68b5911..dff17da 100644 --- a/AttachmentGallery/ControlManifest.Input.xml +++ b/AttachmentGallery/ControlManifest.Input.xml @@ -1,6 +1,6 @@ - + 2 From 18f8f0e4d4925ce7a2f15cc6dca578ad5278cfee Mon Sep 17 00:00:00 2001 From: Christian van der Geer Date: Mon, 29 Jul 2024 13:10:14 +0200 Subject: [PATCH 2/3] fix: file column mimetype issues and use metadata to retrieve plural name - We notices Dynamics sometimes uses octet-stream mimetype for png/jpg/jpeg images and PDF files in file columns - First version had hardcoded logicalname+s for plural name (for download API). Now we use the MetaData API to get it --- AttachmentGallery/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/AttachmentGallery/index.ts b/AttachmentGallery/index.ts index 0f59055..f685daf 100644 --- a/AttachmentGallery/index.ts +++ b/AttachmentGallery/index.ts @@ -447,16 +447,24 @@ export class AttachmentGallery implements ComponentFramework.StandardControl response.blob()); console.log("Retrieved file contents", fileContent); From 6bbb8e63e8a53dd7cc430224edee2276325ab46e Mon Sep 17 00:00:00 2001 From: Christian van der Geer Date: Mon, 29 Jul 2024 13:41:06 +0200 Subject: [PATCH 3/3] Fix: Forgot logic for PDF files --- AttachmentGallery/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AttachmentGallery/index.ts b/AttachmentGallery/index.ts index f685daf..40036fb 100644 --- a/AttachmentGallery/index.ts +++ b/AttachmentGallery/index.ts @@ -475,7 +475,7 @@ export class AttachmentGallery implements ComponentFramework.StandardControl