bottom line: programmatic update of query does not work as expected."
private void UpdateViewV2()
{
SPSite site = SPContext.Current.Site;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite elevatedPrivilegesSiteColl = new SPSite(site.ID))
{
using (SPWeb oWebsite = elevatedPrivilegesSiteColl.RootWeb)
{
oWebsite.AllowUnsafeUpdates = true;
SPList oList = oWebsite.Lists[this.listName];
SPView oView = oList.Views[this.viewName];
oView.Query = ""+
"" + this.strStartDate + " "+
"" + this.strEndDate + " "+
" ";
oView.Update();
oList.Update();
oWebsite.AllowUnsafeUpdates = false;
oWebsite.Update();
}
}
});
site.Close();
}
0 comments:
Post a Comment