SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(SPContext.Current.Site.ID)) { using (SPWeb oweb = site.AllWebs[SPContext.Current.Web.ID]) { oweb.AllowUnsafeUpdates = true; SPList list = oweb.Lists.TryGetList("图像"); if (list != null) { SPFolder folder = list.RootFolder; folder.Files.Delete(urlFile);//urlFile是ServerRelativeUrl } oweb.AllowUnsafeUpdates = true; } } });