Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Upload to Dataverse from sharepoint - Content is empty

(0) ShareShare
ReportReport
Posted on by 2
Hi everyone,

I'm trying to create a flow that looks through a folder in sharepoint and uploads every file in it to a rows in a Dataverse table. The files in question will be word files.

I have built a very simple flow to test this but the problem I have is that, in the upload to dataverse step, the input is showing the content of the file but the output is just empty...

Anyone have any experience with this? Looking through the forum at similar topics did not really help me... A general picture of the flow is attached, if you need more information happy to provide it.

Thanks!

*edit* update picture with full flow
 
Categories:
  • creativeopinion Profile Picture
    creativeopinion 10,023 on at
    Upload to Dataverse from sharepoint - Content is empty
    The dynamic content you've inserted into the content field of the Upload a file or an image doesn't seem to be correct. You should be inserting the File Content dynamic content from the Get File Content Path action. Can you try that? Also, I believe your word doc must be saved with a .docx file (not .dotx)
     
    Hope this helps!
  • ri_mar Profile Picture
    ri_mar 2 on at
    Upload to Dataverse from sharepoint - Content is empty
    Hi creativeopinion,

    Thanks for taking the time to reply and for your detailed explanation.

    A bit more context is warranted here. I am building a solution that uses data from Dataverse, which the user interacts with using a canvas app. In the app the user can see their own projects and then use a button to automatically generate a number of documents based on a word template. It is here that Power Automate comes in, and the end result should be that each generated document is attached to a column in a Dataverse table that then has a lookup to the specific project the user is working in, then allowing the user to browse their documents, for that project, on the canvas app.

    When building the flow everything goes great until I have to upload the file to Dataverse. I could not use the output of the "Populate a word template" to directly upload, so I thought I'd have to first create the file somewhere (like Sharepoint) and then upload that file and delete it. Did not matter what I tried, nothing work, so in order to troubleshoot the upload, I created a small test word file in sharepoint and separated the part of the flow that does the upload into a different flow, so that I don't have to keep waiting for files to be generated.

    Long story short, it does not matter what or how I do it, I just can not seem to be able to upload these files. I've tried a number of things (direct upload form the generate word file, file format conversions, upload from one drive vs sharepoint,...), nothing seems to work. When I look at tests of the "Upload a file or an image" step specifically, the input always looks like this:
     
    {
      "$content-type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "$content": "UEsDBBQABgAIAAAAIwvX3JlbHMvaXRlbTMueG1sLnJlbHNQSwUGAAAAABUAFQB7BQAA3UkAAAAA"
    }
    (I have shortened the "$content" here, since it is huge)

    but then the output looks like this, no matter how I try to do it:
     
    {
        "statusCode": 204,
        "headers": {
            "Cache-Control": "no-cache",
            "Set-Cookie": "<redacted>",
            "x-ms-service-request-id": "<redacted>",
            "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
            "REQ_ID": "<redacted>",
            "CRM.ServiceId": "CRMAppPool",
            "AuthActivityId": "<redacted>",
            "x-ms-dop-hint": "<redacted>",
            "x-ms-ratelimit-time-remaining-xrm-requests": "<redacted>",
            "x-ms-ratelimit-burst-remaining-xrm-requests": "<redacted>",
            "mise-correlation-id": "<redacted>",
            "OData-Version": "4.0",
            "X-Source": "<redacted>",
            "Public": "OPTIONS,GET,HEAD,POST",
            "Date": "Tue, 03 Dec 2024 15:29:59 GMT",
            "Allow": "OPTIONS,GET,HEAD,POST",
            "Content-Type": "text/html; charset=utf-8",
            "Expires": "-1",
            "Content-Length": "0"
        }
    }
    (redacted some code here I wasn't it was safe to share)

    So it looks like something is going in but then nothing is going out...
  • creativeopinion Profile Picture
    creativeopinion 10,023 on at
    Upload to Dataverse from sharepoint - Content is empty
    @ri_mar It's hard to offer any recommendations without seeing your full flow and the logic behind it. Toggle off the New Designer and click each action to expand it. Upload a screenshot of your flow in edit mode.
     

    Get Files (Properties Only)

    This action returns files and folders. To filter out files only you can use the following filter query:
    FSObjType eq 0
    
    If you can share what your current query looks like, it'll help to provide more insights.
     
    Toggle On Pagination
     
    Additionally, the default limit of files returned by the Get Files (properties only) action is 100. You will need to toggle on pagination. Click on the three dots of the Get Files (properties only) action. Select Settings.
     
    Toggle on pagination and set a threshold. Scroll down and press done. Keep in mind that retrieving a large number of items can slow down your flow significantly. It’s always better to filter results as much as possible to minimize the number of items retrieved.

     
    Return Count of Items
    Whenever I use a Filter Query in a Get Items action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow.

    Insert a Compose action. Add an Expression. Use the length() function.

    Select the Dynamic content tab and insert the value dynamic content from the Get Items action into the length() function.


    Run a test.
     
    Condition Check
    Add a Condition action to your flow. If items have returned (aka there is number stored in the Compose action—that is not equal to 0), add the rest of your actions to the Yes branch. If not, do nothing.
     
     
    It's unclear why you want to upload a file to dataverse. Would the file be edited at any point in time. If so, have you considered maybe including a link to the file on SharePoint instead of the content?
     
    Hope this helps!

    Consider giving me a ❤️ if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Kickstarter Events…

Register for Microsoft Kickstarter Events…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,940

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,523

Leaderboard