How to make SharePoint Online to update files inside modules
-
09-12-2019 - |
Question
We have deployed solution to SharePoint Online with following elements.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MyModule">
<File Path="MyFilePath\MyFile.aspx" Url="MyFileUrl/MyFile.aspx"/>
</Module>
</Elements>
Then we updated our solution with changes in MyFile.aspx file but we cannot see those changes in SharePoint. Is there any way to force SharePoint Online to 'refresh' solution files? Out of curiosity does somebody know where those files are kept ?
Solution
What you could do is:
- Create a Feature Event Receiver.
- Delete your files on FeatreUpgrading.
- Bump your package so the solution can be upgraded.
This will delete the files from the database, so on upgrade they will be replaced because they do not exist.
If this does not work you could try on feature deactivating.
OTHER TIPS
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
using (SPWeb web = ((SPSite)properties.Feature.Parent).OpenWeb())
{
SPFile g = web.GetFile("ModuleName/Page.aspx");
g.Delete();
}
}
Try this, unfortunately needs to be hardcoded as I haven't found a way to enumerate through modules.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange