My end goal is more complex but below is a basic example of the issue I’m having that just simply does not work.
I'm trying to use a site workflow to create an item in a document library that has a document template applied to it but the file that gets created by the workflow is corrupt and cannot be opened.
I created a document library and edited the document template by adding some text to the header and changing it to a Word docx file instead of a Word dotx file. I tested the document template by clicking the files tab in the ribbon and then clicking new document which opens the document template in Word and allows me to edit and save the document back to SharePoint. Then I created a SharePoint 2013 site workflow in SharePoint Designer that contains a single Create List Item action, and that action creates an item in the document library with the name field statically defined. I published the workflow and then manually start it on the site. The workflow completes successfully and when I navigate to the document library the document has been created by the workflow. When I click on the document to open it in the Word Web App it throws the error pictured below and if I open it in the Word client application it just opens a blank document and not the correct document template.
I also tried using a SharePoint 2010 workflow with pretty much the same results. Opening the document in Word Web App gives the same error as above and opening the document in the Word client application gives the error pictured below.
Come on Microsoft creating a Word Document in a SharePoint Document Library from a SharePoint Workflow should just work! Is this a bug or does anyone have any ideas on what is causing the this issue?
I have the same issue and researching found many others with this same problem. Looks like I will need to use up one of my limited calls to find out if this basic functionality has a work around or a fix.
I might be late in replying to this question; but for anyone who is looking for an answer.
In your workflow you need to select "ContentTypeId" and set it as your custom document template (.docx) for it to work. This is done at the place where remaining fields are mapped.
- Proposed as answer by NBurgess Thursday, March 13, 2014 9:31 AM
I had the same problem with corrupted document - this worked for me:
1. Create a 2010 Workflow which creates the list element in a document library
(you may start this workflow from your 2013 workflow if applicable)
2. In the Create New List Item properties - make sure to set ContentTypeId to your content type
("Id for indholdstype" is Danish for "Contenttype ID")
3. Your Content Type template should be a ".docx" file - NOT a ".dotx" file...!
(I have always created my templates for content types as .dotx files - seems Microsoft wants us to use ordinary .docx files as template files for content types)
Hope this helps you!
I also have this problem and I'm using a .docx.
Am using Onsite SharePoint 2013, SPD2013 with 2010 workflows and Word 2013.
When I add a document with a .docx template from a content-type using the New Document button on the Files Ribbon I am able top open with Word 2013.
When I add it using the "Create List Item" action in a 2010 Workflow it is created but when I attempt to open it with Word 2013 I get: "We’re sorry. We cannot open <var class="sbody-var"><file_name></var> because we found a problem with its contents."
The article at support.microsoft.com/en-us/kb/2889634 suggests a workaround but this would remove any benefit of using content types.
The article then goes on to explain that the problem is by design. Can someone at Microsoft please explain?
If anyone has any suggestions I'd really appreciate it. At the moment I've hit a roadblock as I really want to create a document from a content-type that is pre-filled with data from the site.
Are there any news on this?
My .docx-template is working perfectly fine whenever i select new item in the ribbon, but when using a workflow to create the item the template isn't working.
Unfortunately using a 2010 workflow is not an option in my setup.