none
SharePoint Doc Library, error while opening a document

    Question

  • Hi

    I have created a doc library and assigned a word document as a content type to it. I have written a workflow to create a new document. When document is created, using view properties I can see all the properties correctly which I set from workflow. But when I download a document and try to open it, system shows an error: "There was an error opening a file"

    What could be the reason behind this? How can I download and see the document?

    Monday, September 16, 2013 11:23 AM

Answers

  • Hi Pratima,

    To add a template to a content type, you can follow the steps below:
         1. Go to the library settings and click the corresponding content type that you need.
         2. Click Advanced settings under Settings to add a template to the content type.

    If you need to change the values of the fields in the library by using workflow, I recommend to add these fields to the content type which is used to new a document.
    Here is the detailed steps to add these fields to the content type:
         1. Go to the library settings and click the corresponding content type that you need.
         2. Click Add from existing site or list columns under Columns and then add the columns that you need.

    Best regards.
    Thanks

    Wednesday, September 18, 2013 1:04 AM
    Moderator

All replies

  • how many content types are associated to your document library? which content type is associated to the created document and under the advanced settings of that content type, what document template is used?

    Regards

    Sergio Giusti
    http://sergioblogs.blog.co.uk/

    Whenever you see a reply and if you think is helpful, click " Alternate Text Vote As Helpful". And whenever you see a reply being an answer to the question of the thread, click " Alternate Text Mark As Answer".

    Monday, September 16, 2013 2:54 PM
  • Thanks Sergio for the reply.

    Only one content type is there. But I have not associated any template to it. How to create a template for content type in order to store workflow data in file?

    Can you please share links regarding creation of template?

    Tuesday, September 17, 2013 9:26 AM
  • Hi Pratima,

    According to your description, my understanding is that the error occurred when you open the downloaded word document in the Office Word.

    First, I need to make sure the things below:

    1. Did the documents in local disk can be open in Office Word?
    2. Did this error occur when open other word files in another library in Office Word?

    If both not, I recommend to open the word files in browser to see if the files can be open with no error.

    If the word files in local disk cannot be open in Office Word, I recommend to repair the Word and re-open the word files.

    Best regards.

    Thanks

    Tuesday, September 17, 2013 9:50 AM
    Moderator
  • Hi ,

    Have you tried creating the document from SharePoint and not from the workflow ?

    If you have this issue only when creating the document from your workflow, make sure your Stream has been closed.


    Best regards, Mahmoud Challouf MCTS .NET Framework , WCF , SharePoint www.innersharepoint.blogspot.com

    Tuesday, September 17, 2013 10:24 AM
  • I changed the few settings from advanced settings of library. And now not receiving any error. But the document is empty. The fields I have set from workflow are reflecting in document properties but not getting added in actual document.

    As mentioned in first reply I need to attach a template to content type. But I am unaware about how to create a template such that workflow activities can change document contents. Please suggest on creating templates.

    Any help is appriciated. Thanks.




    Tuesday, September 17, 2013 10:43 AM
  • Hi Pratima,

    To add a template to a content type, you can follow the steps below:
         1. Go to the library settings and click the corresponding content type that you need.
         2. Click Advanced settings under Settings to add a template to the content type.

    If you need to change the values of the fields in the library by using workflow, I recommend to add these fields to the content type which is used to new a document.
    Here is the detailed steps to add these fields to the content type:
         1. Go to the library settings and click the corresponding content type that you need.
         2. Click Add from existing site or list columns under Columns and then add the columns that you need.

    Best regards.
    Thanks

    Wednesday, September 18, 2013 1:04 AM
    Moderator
  • Thanks Victoria for the response.

    I have followed following steps:

    1. Created an Infopath form and published it to sharepoint site. All the infopath fields are published as a site column
    2. Created a document content type. Added those site columns to content type. Assigned content type with document library
    3. Created a workflow on infopath form library to create a new document in document library. New document's content type id is set

    I am using these steps in order to convert infopath form to a word document. Please correct me if the procedure is going wrong anywhere.

    Wednesday, September 18, 2013 5:24 AM
  • Thanks Sergio for the reply.

    Only one content type is there. But I have not associated any template to it. How to create a template for content type in order to store workflow data in file?

    Can you please share links regarding creation of template?

    Hi

    you need to save a word document (anywhere will do at this point also it could be an excel workbook, etc. it doesnt need to be a word doc but for this example ill use that) that should be used as the template.  Then under the advanced settings of the content type change the template used to use this word document.  Make sure the metadata (columns) within your library that are required and used within the content type are associated to the content type.  And presumably as your creating a document from a workflow you will want to go into the word document and drop in some quick parts so that the column info pulled in from the workflow to the list item will auto show in the document.


    Regards

    Sergio Giusti
    http://sergioblogs.blog.co.uk/

    Whenever you see a reply and if you think is helpful, click " Alternate Text Vote As Helpful". And whenever you see a reply being an answer to the question of the thread, click " Alternate Text Mark As Answer".

    Wednesday, September 18, 2013 7:04 AM
  • Thanks for the reply.

    Actually I have not any expirience to create a template to pull metadata. Please share any links with detailed explaination of creating such templates.

    Wednesday, September 18, 2013 8:38 AM
  • Thanks for the reply.

    Actually I have not any expirience to create a template to pull metadata. Please share any links with detailed explaination of creating such templates.

    Hi

    Ive created a Guide for you in my blog, within it are instructions on how to change the template of a content type and also on how to assign columns or metadata from a document library into a word document so you dont need to type out something you or someone else has already typed out.


    Regards

    Sergio Giusti
    http://sergioblogs.blog.co.uk/

    Whenever you see a reply and if you think is helpful, click " Alternate Text Vote As Helpful". And whenever you see a reply being an answer to the question of the thread, click " Alternate Text Mark As Answer".

    Wednesday, September 18, 2013 10:58 AM
  • Thanks a lot Sergio for your efforts. Actually we don't have word installed on the system where sharepoint server is installed. So I am not able to open the new document from server. If I click on edit template or new document I receive following error:

    Is it possible to create the template on our own and upload it on SP server? If this is possible then I can create a template using my local computer and use it on remote computer where sharepoint is installed.

    Thanks again for your help.


    Wednesday, September 18, 2013 12:14 PM
  • Thanks a lot Sergio for your efforts. Actually we don't have word installed on the system where sharepoint server is installed. So I am not able to open the new document from server.

    Is it possible to create the template on our own and upload it on SP server? If this is possible then I can create a template using my local computer and use it on remote computer where sharepoint is installed.

    Thanks again for your help.

    Hi

    yes, at no point in that example was i connected to the server itself, i did that whole example from my local computer using my locally installed software (word, sharepoint designer, access the site using IE)


    Regards

    Sergio Giusti
    http://sergioblogs.blog.co.uk/

    Whenever you see a reply and if you think is helpful, click " Alternate Text Vote As Helpful". And whenever you see a reply being an answer to the question of the thread, click " Alternate Text Mark As Answer".

    Wednesday, September 18, 2013 12:35 PM
  • What about the error I receive then? Even if I do it from my local computer I receive the same error. Will there be the problem of versioning?

    Is it possible to download the document and share it on some other location for users who are not sharepoint users?

    I did it for InfoPath forms. But for forms system was trying to locate form's template. And non-sharepoint usres couldn't access the shared copy of form in spite of having infopath filler. Will the same thing happen with these word documents also?

    Wednesday, September 18, 2013 12:49 PM
  • Hi

    You wont get the error regarding the content type not having a template if you follow my guide as you assign a template to the content type, if your still getting the issue, it may be that your content type doesnt have the columns associated to it.

    In regards to other users who arent sharepoint users, yes you will have a problem doing it this way as even if you save the word documents locally, when loading they will still try and contact the sharepoint server for the metadata.  The only way round that would be when the document arrives in the document library, your users would need to save the file as a PDF before sending it to a 3rd party (I believe there is something on Codeplex also that may help you automate that process so when the workflow runs and creates the word document the Word Automation can create a second copy of the document as a PDF in the same document library) - http://sp2010wordautomation.codeplex.com/)


    Regards

    Sergio Giusti
    http://sergioblogs.blog.co.uk/

    Whenever you see a reply and if you think is helpful, click " Alternate Text Vote As Helpful". And whenever you see a reply being an answer to the question of the thread, click " Alternate Text Mark As Answer".

    Wednesday, September 18, 2013 2:25 PM
  • I created a new content type with few columns associated with it. And then added this content type to document library. Then clicking content type from document library, I clicked to advanced settings. And then clicked on edit template. I am getting the same error.

    Thursday, September 19, 2013 5:37 AM