cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
audrieg
Level 10

Flow to Create File

Environment details: Sharepoint in Office 365 - creating the Flow from the List Ribbon in the new Modern Experience.

 

When I use the template "When a new item is added in SharePoint, complete a custom action" to create a file in a SharePoint Library, it does not seem to allow me to select a Content Type at the library destination. Is it possible to specify the content type to be used?

 

I didn't specify one, and yet, it did not pick up the default content type either - it created a file without an extension. (I guess that means I need to add the extension in the file name area, right?)

 

screenshot.PNG

 

Here is the updated flow with the extension added. The file is created (default content type picked up) but the new file can not be opened.

 

flow.PNG

 

sessionID.PNG

 

If I click "Edit in Word" - it opens the file blank (even though the template has preformatted placeholders).

 

Creating a default file using the New command opens the template with preformatted text.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Flow to Create File

Hi audrieg,

 

I reproduced the issue:

Capture.PNG

 

I think this is because that flow treat "File Content" field as a whole exsiting file. I mean that if you got a file in the trigger, then you put this trigger file content into this "File Content" field in SharePoint create file action, this will create a correct file and you can open it in SP.

Capture1.PNG

 

Regards,

Mona Li

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
Community Support Team
Community Support Team

Re: Flow to Create File

Hi audrieg,

 

I reproduced the issue:

Capture.PNG

 

I think this is because that flow treat "File Content" field as a whole exsiting file. I mean that if you got a file in the trigger, then you put this trigger file content into this "File Content" field in SharePoint create file action, this will create a correct file and you can open it in SP.

Capture1.PNG

 

Regards,

Mona Li

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Community Support Team
Community Support Team

Re: Flow to Create File

See above.

 

Moan Li

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
audrieg
Level 10

Re: Flow to Create File

I love your idea, but I don't see FileContent as a tag in my UI. I typed it but I don't think that's what you mean.

 

FileContentMissing.PNG

Super User
Super User

Re: Flow to Create File

Hi,

 

This might be something to do with your SharePoint list library type?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



audrieg
Level 10

Re: Flow to Create File

Yes, and no. Smiley Happy

It has to do with the fact that I'm not starting with a library, I am initiating the flow from a list.

What I also found out is that the same 'bug' occurs when I try to create the file using SharePoint Designer (which does have a way to specify the content type name).

 

So, I revised my flow to start by copying a template file from one library to the destination library (since that file already has content I thought that would get me that "FileContent" tag - but alas it doesn't. Flow copies over the file, but I get the same error message - it appears the file is corrupting on creation.

 

Any ideas of what I might be able to do to get a new file in a library (I'm ok with it being based on the default content type since there is only one in the library. Do you think it could be becaue the template is customized? (It has headers and footers for company branding.)

 

FYI: I never have this problem when I create a new file using the "New" command directly in the library in the UI....only when I try to create it from a workflow method external to that library.

 

Appreciate any ideas...

 

 

Super User
Super User

Re: Flow to Create File

Hi,

 

You mentioned "I never have this problem when I create a new file using the "New" command directly in the library in the UI".

 

So here are you creating the title first and attach the file?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Super User
Super User

Re: Flow to Create File

Hi,

 

I think this might helps. So for every lists there is an 'Attachments' in SharePoint. Try to set the following in Create File Flow

 

Site URL:
Your SP Site

 

Folder Path:
/List/YourListName/Attachments

 

Filename:
Set the Filename

 

FileContent:
Set the File Content

 

Please let me know how it goes?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



audrieg
Level 10

Re: Flow to Create File

I give you BIG KUDOS for such a great idea! Only, even if it works I can't use it. I need to create a file based on a template (and I can't set a template for a list attachment). Let me know if I'm wrong....but without being able to specify a content type the attachment approach won't work. (I did put this in my idea journal....cause I will go back to it if/when they add Content Type to the Create File options in Flow.

 

Update: For some reason FileContent is not available for attachments either.

Super User
Super User

Re: Flow to Create File

Hi,

 

Thanks for the BIG KUDOS Smiley Happy Can you please check your List settings > Advanced settings > Attachtment to list items are enabled or not?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



audrieg
Level 10

Re: Flow to Create File

Yes, and I tested that I can add an attachment manually without issue (I believe that is default unless you turn it off).

Anonymous
Not applicable

Re: Flow to Create File

I'm getting this same error. Can the "File Content" be the content of a file other than the source file that is the trigger which creates the file?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 394 members 5,790 guests
Please welcome our newest community members: