I have a custom EDIT/NEW/View forms for a content type.
i need to change the properties programmatically since i have over 1000sites using these forms
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://v058mosffe008:8080/sites/pmo")) // e.g. http://server/sites/asite
using (SPWeb web = site.OpenWeb("afspmo"))
using (SPWeb subweb = web.Webs["projecttemplate"])
{
SPFile fileT = subweb.GetFile("Lists/Quality Gate Checklist/InitiateNewForm.aspx"); // e.g. /sites/asite/default.aspx
SPLimitedWebPartManager lwpm = fileT.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
SPLimitedWebPartCollection webParts = lwpm.WebParts;
foreach(WebPart webpart in webParts){
if (webpart.Title == "QA Checklist (1)")
{
FileStream stream = new FileStream("C:\\file.txt", FileMode.Open);
StreamReader reader = new StreamReader(stream);
string xsl = reader.ReadToEnd();
DataFormWebPart dvWebpart = (DataFormWebPart)webpart;
string preXSL = dvWebpart.Xsl;
dvWebpart.Title = "QA Checklist (1)";
dvWebpart.Xsl = xsl;
lwpm.SaveChanges(dvWebpart);
fileT.Update();
subweb.Update();
}
}
}
}
when i run this code, i see that it has updated the webpart in code, but the changes dont reflect when i navigate to the page. it seems to be some sort of caching, any ideas