Programmatically adding files in a module to a library in SharePoint


  • Hello all,

    I'll have a module that will contain XAP files and .csv files that I want to load into libraries in a SharePoint site.  I've done some googling and haven't come up with much.  I know how to add a module to the project and then add the files to a module, but I'm coming up short on how to programmatically place these files into a SharePoint site.  Does anyone know any sites that show how to do this or have example code?  Thanks, Shaun.

    Tuesday, May 15, 2012 5:50 PM


  • Hi Shaun,

    Thanks for your post!

    Usually, when you deploy the file with module, it will be deployed under the 14 folder, for example, the module with below xml:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="">
      <Module Name="Module1">
      <File Path="Programming skill survey__v-simhu.docx" Url="Module1/Programming skill survey__v-simhu.docx" />

    The file will be deployed to :C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\SharePointProject2_Feature1

    So if you want to add the file to the document library, you can find the location of the file, then in feature activited event, programmatically upload the file to the library.

    For information about programmatically upload the file, please refer to:


    Simon Huang

    TechNet Community Support

    • Marked as answer by Shimin Huang Friday, May 25, 2012 6:46 AM
    Tuesday, May 22, 2012 3:18 AM

All replies