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?)
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.
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.
Solved! Go to Solution.
Hi audrieg,
I reproduced the issue:
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.
Regards,
Mona Li
Hi audrieg,
I reproduced the issue:
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.
Regards,
Mona Li
See above.
Moan Li
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.
Hi,
This might be something to do with your SharePoint list library type?
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogYes, and no.
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...
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
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi,
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
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogI 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.
Hi,
Thanks for the BIG KUDOS Can you please check your List settings > Advanced settings > Attachtment to list items are enabled or not?
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogYes, and I tested that I can add an attachment manually without issue (I believe that is default unless you turn it off).
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?
How is this the solution? Maybe I missed it, but I don't see the answer to the question, "how is the File Content created?"
Try using below expression for file name:
concat(variables('ID'),'Invoice.docx')
User | Count |
---|---|
88 | |
37 | |
25 | |
13 | |
13 |
User | Count |
---|---|
121 | |
55 | |
36 | |
24 | |
21 |