SPListItem Update Operation is not valid due to the current state of the object(对象的当前状态使该操作无效。)

System.InvalidOperationException: 对象的当前状态使该操作无效。 在 Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context) 在 Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(HttpContext context) 在 Microsoft.SharePoint.Utilities.SPUtility.RedirectToAccessDeniedPage(HttpContext context) 在 Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(Exception ex) 在 Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex) 在 Microsoft.SharePoint.Library.SPRequest.CrossListQuery(String bstrUrl, String bstrXmlWebs, String bstrXmlLists, String bstrXmlQuery, ISP2DSafeArrayWriter pCallback, Object& pvarColumns) 在 Microsoft.SharePoint.SPWeb.GetSiteData(SPSiteDataQuery query) 在 EDS.EntComm.WebService.EntCommWebService.<>c__DisplayClass19.<GetMyTopic>b__18() 在 Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state) 在 Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2() 在 Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) 在 Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) 在 Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) 在 EDS.EntComm.WebService.EntCommWebService.GetMyTopic(String strAccount, UInt32 rowCounts)

由于用了

SPSecurity.RunWithElevatedPrivileges(delegate(){});提升权限,并把对List的操作也放到提升权限里面了。

把对List的操作放到外面,错误解决。

你可能感兴趣的:(current)