I'm creating a SharePoint Hosted Addin on SharePoint Online. I have added a List to my project based on the Assets Library instance.

Can someone tell me how I can prepopulate the list with some data? I understand that if it were an ordinary list, without a file associated with it, I could achieve this using tags in the elements.xml file. However, how does this work if I want my assets library to have content when it is installed?

I'd like the library to have some images in it.


You need to add a module to your Add In project and the modify the xml file generated for you to look something like this:

 <Module Name="MyImages" Url="SiteAssets">
    <File Path="MyImages\myimage1.png" Url="myimage1.png" ReplaceContent="TRUE" />
    <File Path="MyImages\myimage2.png" Url="myimage2.png" ReplaceContent="TRUE" />
  • Thanks! This worked. I just had to change the URL value to "Lists/MyList" and it was able to prepopulate my app list with the files. Cheers! – Ray Hogan Sep 29 '16 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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