How to embed a XML file in the wsp solution RRS feed

  • Question

  • hi,

     I want to  add  XML file into the wsp package[embeded inside wsp ], it would be great to know if i can embed inside a  feature and during the featureactivated event i can read/update this xml file.my env.  is MOSS 2007 [VS 2008/ wsp builder].

    Any help is appreciated



    • Edited by DADasRF Saturday, August 20, 2011 7:35 AM s
    Saturday, August 20, 2011 7:33 AM


All replies

  • Hi Shankar,


    Well since your env. is MOSS 2007  and there was no sandbox concept in 2007 so you can simply add a folder under you 12 directory structure in your project solution, which is picked up when the wsp is getting created. So simply create a folder or you can also create a feature which uses the <MODULE> element to upload the xml in a default document library (that ways the xml will be embedded as a part of that feature folder in you solution). 


    Now on feature activation once the file is uploaded to the default library you can then easily read it in your code and do the required operations.


    Hope this makes sense and helps!!


    - "T"

    Saturday, August 20, 2011 2:53 PM
  • Hi  Tanmay,

    thnx  for the suggestion.

    Am not aware of the feature with  MODULE  element  concept inthe features. can you pls  help, /elaborate with   some sample code.

    thnx in advance....

    Saturday, August 20, 2011 3:24 PM
  • If it is ok with you  to place the XML file directly on the 12 hive of your SharePoint server Under some directory then just create the similar folder structure in your wsp builder Project and keep XML file there in the solution.

    When wsp will be deployed then your XML file will also be deployed at the location Specified by you.

    Else you can deploy your XML file in some library of your SharePoint site using <Module> Element.

    Here is reference for you

    What is Module element - http://msdn.microsoft.com/en-us/library/ms460356.aspx

    How to provision a file - http://msdn.microsoft.com/en-us/library/ms441170.aspx

    hope this helps you.


    Warm Regards, Bhushan http://www.passionatetechie.blogspot.com

    • Edited by Bhushan Gawale Saturday, August 20, 2011 8:44 PM added links
    Saturday, August 20, 2011 8:39 PM
  • Also while packaging the feature you can specify to add a file to the package by editing the wspbuilder.cofing file at the WSP builder installtion path.So when every the WSP bulder buid is taken the file gets added to the package. Toy can verify the same by opening the .wsp file with a .cab extension
    Regards, Aj (http://www.aj-sharepoint.blogspot.com/) MCTS
    Monday, August 22, 2011 9:40 AM
  • in SharePoint 2010.. click on your project and add a new item.. choose the template for Module in the items and now a module element is added to the project... add your file to this module folder... by right click on the module and say add... then update the elements xml in this module structure which is already created with the module.. to point the file to intended location... and then inlclude this module element to your feature... hope thats clear...
    "T" | community.zevenseas.com/Blogs/Tanmay/default.aspx
    Tuesday, August 23, 2011 12:50 PM
  • Tanmay, Thnx  for the reply.

    Can you  help me with the MOSS 2007 solution approach. or any links ...

    thnx again.


    Wednesday, August 24, 2011 5:03 AM
  • You can use the same thing in MOSS 2007 way in feature folder ... so when you create a 12 directory structure in your solution to create wsp with wsp builder.. create a folder for feature and add the elements and the xml file to it and then again use the module and file attributes in the elements file.


    Check out this blog .. http://blogit.create.pt/blogs/andrevala/archive/2009/01/10/SharePoint-2007-Deployment_3A00_-Module-Features.aspx

    do mark answer if it helps.

    "T" | community.zevenseas.com/Blogs/Tanmay/default.aspx
    • Marked as answer by star.wars Friday, September 2, 2011 8:54 AM
    Wednesday, August 24, 2011 9:05 AM