0

I have an app that deploys several lists, one of which is a document library.

I would like deploy a default document (help file) with the document library list, is this possible with a SharePoint hosted app?

1 Answer 1

2

For anyone wanting to know how to do this...the link below explains all, tested and deployed, it works.

Deploying a Document Library including content using a Feature

Recently I needed to deploy a SharePoint document library as a feature, but with some documents already in it. In my case it was because of demo content, the customer wanted to do some training and needed a pre-filled document library. I can see this useful in other times however, such as including templates for documents, etc.

The solution for this is not difficult, but since I could not find any instructions online for this I thought I'd write a post.

In short, you need to create a feature that includes two components. A list instance based on a document library and then a module with the documents that you want to add to your library. The module has to point to your newly created library and all is well.

Once you have added your new modules (which contains your content) then you need to edit the XML files like so

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="DemoDocumentContent" Url="Lists/DemoDocuments">
   <File Path="DemoDocumentContent\demo1.docx" Url="demo1.docx" Type="GhostableInLibrary" />
 </Module>
</Elements>

The module URL is the URL of your document library. You can also an the "Name" to the file if you want.

Hope this helps.

2
  • Please add more details from the link to your answer, if the link breaks this answer will be of no help to future readers :) Apr 29, 2014 at 11:40
  • You will be able to if you are not already (it is a timer ticking) Apr 29, 2014 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.