Let’s assume you need to do this from an application page, you need to use the SPSecurity and RunWithElevatedPrivileges as usual.
1 2 3 4 5 6 7 8 | SPSecurity.RunWithElevatedPrivileges(() => { using (SPSite elevatedSite = new SPSite(site.ID, site.Zone)) { TaxonomySession taxonomySession = new TaxonomySession(elevatedSite); //Do here the update work } }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | SPSecurity.RunWithElevatedPrivileges(() => { using (SPSite elevatedSite = new SPSite(site.ID, site.Zone)) { HttpContext oldContext = HttpContext.Current; try { HttpContext.Current = null ; TaxonomySession taxonomySession = new TaxonomySession(elevatedSite); //Do here the update work } finally { HttpContext.Current = oldContext; } } }); |
0 commenti:
Post a Comment
Because of a lot of SPAM about courses, I need to moderate all comments here.
I ensure you that I will answer whenever possible (if you are not a spammer).