Update-SPSolution & Items in a Document Library
-
10-12-2019 - |
Question
I have the following situation:
solution1.wsp that has a document library with files inside (I use a module element for adding new files to the feature)
and solution2.wsp that has a document library with different files inside (with new files in a module)
I have tried to use the Update-SPSolution
cmdlet, but with no success. The document library items were not changed.
I have investigated Update-SPSolution
's behavior and it is probably impossible to add new items (in a module element).
Is it possible to add new items to a feature via a module and then do Update-SPSolution
operation?
Solution
I have find answer to my question. Yes, you can. You can use element. msdn.microsoft.com/en-us/library/ee537916(v=office.14).aspx And use same file elements.xml with new content.
OTHER TIPS
The detailed description of the Update-SPSolution
at MSDN - Update-SPSolution for both SharePoint 2010 and 2013 says:
The
Update-SPSolution
cmdlet upgrades a deployed SharePoint solution in the farm. Use this cmdlet only if a new solution contains the same set of files and features as the deployed solution. If files and features are different, the solution must be retracted and redeployed by using theUninstall-SPSolution
andInstall-SPSolution
cmdlets, respectively.
So unfortunately, no, you can't add new files to a document library via a module by using Update-SPSolution
.
You can't add new files to document library using Update-SPSolution but instead you can build a feature that creates (or to an already created document library) a document library including some default documents already in the library. The feature should be web scoped, include a list instance element and a module element with all the necessary content files. By changing the URL parameter in the module you can ensure that the documents are placed in the new/existing document library.
Here is a smart example on how to do it.