none
PDFs truncated when attaching from SharePoint document library RRS feed

  • Question

  • Hello,

    I have designed a logic web app workflow that attaches a PDF document from a SharePoint Online document library and then sends an email. However when the PDF is received the attachment appears truncated.

    I have been reading on other forums that maybe the content type is not being detected for the PDF and others have said they believe Logic Web Apps is corrupting the document. For the record this works correctly when using Microsoft Flow.

    See below the code view of my logic web app workflow. Hopefully someone can help. 

    {
        "$connections": {
            "value": {
                "office365": {
                    "connectionId": "/subscriptions/<SubID>/resourceGroups/<RGName>/providers/Microsoft.Web/connections/office365",
                    "connectionName": "office365",
                    "id": "/subscriptions/<SubID>/providers/Microsoft.Web/locations/uksouth/managedApis/office365"
                },
                "sharepointonline": {
                    "connectionId": "/subscriptions/<SubID>/resourceGroups/<RGName>/providers/Microsoft.Web/connections/sharepointonline",
                    "connectionName": "sharepointonline",
                    "id": "/subscriptions/<SubID>/providers/Microsoft.Web/locations/uksouth/managedApis/sharepointonline"
                }
            }
        },
        "definition": {
            "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
            "actions": {
                "Get_file_content": {
                    "inputs": {
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['sharepointonline']['connectionId']"
                            }
                        },
                        "method": "get",
                        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://ondomain.sharepoint.com/sites/Reward'))}/files/@{encodeURIComponent(triggerBody()?['{Identifier}'])}/content",
                        "queries": {
                            "inferContentType": true
                        }
                    },
                    "runAfter": {
                        "Get_file_metadata": [
                            "Succeeded"
                        ]
                    },
                    "type": "ApiConnection"
                },
                "Get_file_metadata": {
                    "inputs": {
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['sharepointonline']['connectionId']"
                            }
                        },
                        "method": "get",
                        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://ondomain.sharepoint.com/sites/Reward'))}/files/@{encodeURIComponent(triggerBody()?['{Identifier}'])}"
                    },
                    "runAfter": {},
                    "type": "ApiConnection"
                },
                "Send_an_email": {
                    "inputs": {
                        "body": {
                            "Attachments": [
                                {
                                    "ContentBytes": "@{base64(triggerBody()?['{FilenameWithExtension}'])}",
                                    "Name": "@{body('Get_file_content')}"
                                }
                            ],
                            "Body": "Hello @{triggerBody()?['FirstName']},</br>\n</br>\nOver the summer, we consulted with you on our new reward offer where you had the opportunity to see your individual package and provide us with your feedback on the proposed offer. \nAs you will have seen in our recent <a href=\"https://ondomain.sharepoint.com/sites/Reward\">OurSpace updates</a> your feedback was invaluable in finalising our final reward offer, which has been approved by the LiveWest Board.</br>\n</br>\nWe are confident that this offer is attractive and competitive, ensuring that we can retain our existing talent and attract new people to our business as we continue to grow.</br>\n</br>\n<h2 style=\"color:#0A1C99;\">Your new reward offer</h2>\nWe are delighted to provide you with your new contract of employment (attached).</br>\n</br>\nFollowing your feedback we will be introducing some of our new terms and conditions in a phased approach. Full of information on the final LiveWest reward offer can be found on OurSpace for more information please click here OurSpace.</br>\n</br>\n</br>\n<h2 style=\"color:#0A1C99;\">Signing your contract</h2>\nPlease electronically sign your contract and return it to our Reward team on <A HREF=\"mailto:rewardteam@livewest.co.uk\">rewardteam@livewest.co.uk</A></br> \n</br>\nIf you do not have this facility available then you can either print it off in one of our offices to sign and scan it to <A HREF=\"mailto:rewardteam@livewest.co.uk\">rewardteam@livewest.co.uk</A> Or if you are not office based please pass the signed copy to your line manager who will then scan and return it to our Reward team on your behalf.</br>\n</br>\n<img src=\"https://ondomain.sharepoint.com/sites/Reward/SiteAssets/Images/electronic-sig.png\" alt=\"Info\" width=\"764\" height=\"242\">\n</br>\n<b>Electronic signature function</b></br>\n</br>\nIdeally, we would like all contracts to be returned signed. However, if you do not return your contract and do not appeal the terms of your contract, we will assume that you are happy with your new terms and conditions and have accepted the final reward offer.</br>\n</br>\n<h2 style=\"color:#0A1C99;\">Appeals</h2>\nIf you wish to appeal your new terms and conditions, you must submit this to the <A HREF=\"mailto:rewardteam@livewest.co.uk\">rewardteam@livewest.co.uk</A> by no later than Friday 29 November 2019, clearly stating the grounds for your appeal.  Our LiveWest Appeals policy can be found on OurSpace.</br>\n</br>\nThank you again for all of your feedback and support throughout harmonisation. We are delighted to now have a strong reward offer in place, which works for you and LiveWest.</br>\n</br>\nIf you have any further queries, please speak to your manager.</br>\n</br>\n</br>\nKind Regards</br>\n</br>\nThe Reward Team",
                            "From": "rewardteam@livewest.co.uk",
                            "IsHtml": true,
                            "Subject": "Private & Confidential - @{body('Get_file_metadata')?['Name']}",
                            "To": "@{triggerBody()?['EmailAddress0']}@{triggerBody()?['EmailAddress2']}"
                        },
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['office365']['connectionId']"
                            }
                        },
                        "method": "post",
                        "path": "/Mail"
                    },
                    "runAfter": {
                        "Get_file_content": [
                            "Succeeded"
                        ]
                    },
                    "type": "ApiConnection"
                }
            },
            "contentVersion": "1.0.0.0",
            "outputs": {},
            "parameters": {
                "$connections": {
                    "defaultValue": {},
                    "type": "Object"
                }
            },
            "triggers": {
                "When_a_file_is_created_or_modified_(properties_only)": {
                    "inputs": {
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['sharepointonline']['connectionId']"
                            }
                        },
                        "method": "get",
                        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://ondomain.sharepoint.com/sites/Reward'))}/tables/@{encodeURIComponent(encodeURIComponent('5bb8213b-67e4-464e-b9ff-7e07298b6659'))}/onupdatedfileitems"
                    },
                    "recurrence": {
                        "frequency": "Minute",
                        "interval": 3
                    },
                    "splitOn": "@triggerBody()?['value']",
                    "type": "ApiConnection"
                }
            }
        }
    }

    Thanks.


    Thursday, October 17, 2019 2:11 PM

Answers

All replies