.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

HTTP Module :Item.Update() gives exception 'Operation is not valid due to the current state of the

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :SharePoint

Hi, I have created a http module to update the list item but when i use the Update function of SPListItem object it gives the error: "Operation is not valid due to the current state of the object". Below is the HTTP Module i have written to update the List Item. Please suggest






public class SiteUsage : IHttpModule



View Complete Post

More Related Resource Links

SharePoint 2010 Publishing Site : Operation is not valid due to the current state of the object.

  I think as usual, the new version of SharePoint 2010 has a lot of problems. the below messege appear in a publushing site (FBA) enabled and when I try to access the pages list or even approve a page of accessing the SiteCollectionImages list and ......... etc every link produce the below error. I'm very frustrated with 2010.  Server Error in '/' Application. <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object.] Microsoft.SharePoint.Library.SPR

Operation is not valid due to the current state of the object

Dear people. Help me, please. I create simple sample project  Business Data Connectivity Model on Visual Studio 2010 (standard sample "Hello World") I edit file "Feature1.Template.xml": <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Feature  Id="bf21f627-600c-4eec-8c01-a49dac59a05a"           Scope="Farm"           xmlns="http://schemas.microsoft.com/sharepoint/"> <Properties> <Property Key="GloballyAvailable" Value="true" /> <Property Key="SiteUrl" Value="http://win-mne65kpc063/ForTestBCS"/> </Properties> </Feature>   I have Sharepoint Server. Site's local URL : http://win-mne65kpc063/ForTestBCS I press F5, and see error:       Error 1 Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object.   0 0 BdcModelProject2 If I make deployment by the Central Administration, I have no error. But, when I display external list whith BCS-model I get error: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. <detail><errorstring xmlns="http://sch

{"Operation is not valid due to the current state of the object."} using WebService

Hi, i am using this method to insert managed paths into my WebApplication using the object model in a Web Project, but it seems that it's not working, always give me the bellow error: 1 - Content Database have AppPool user as DbOwner 2 - I can create site collections, but is writing in the SPWeb direcly, so when i use the WebApplication it will give me always the same error ERROR    at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context)    at Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(HttpContext context)    at Microsoft.SharePoint.Utilities.SPUtility.ValidateFormDigest()    at Microsoft.SharePoint.Administration.SPPersistedObject.Update()    at Microsoft.SharePoint.Administration.SPWebApplication.Update()    at Microsoft.SharePoint.Administration.SPAutoSerializingObject.UpdateParent()    at Microsoft.SharePoint.Administration.SPPrefixCollection.UpdateParent()    at Microsoft.SharePoint.Administration.SPPrefixCollection.Add(String strPrefix, SPPrefixType type)    at WsCreateAddPaths.<>c__DisplayClass3.<CreateAddPaths>b__1() in c:\VS2010\SGE\App_Code\WsCreateAddPaths.cs:line 36    at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)    at Microsoft.SharePoint.SPSecurity.<>c__DisplayCla

Backup failing - Error "operation is not valid due to the current state of the object" ...........Ca

Hi, I am having a problem backing up a site collection, when trying to backup the collection I get the following error  "operation is not valid due to the current state of the object"............. "Category Info :InvalidData" . I'm getting the same error whether I use CA "granular backup" or "Farm backup", and using either STSAMD or Powershell. I can backup CA or the mysite collection but not the Home Portal site collection. As this is a production system I am really worried that something is going to happen and I'll have no backup. Does anyone have any suggestions on what i can do to either fix the problem or an alternative way to backup the collection or farm.  P.S. I am not using the "UseSQLSnapshot" parameter. Any ideas ? 

when adding web reference, I get "Operation is not valid due to the current state of the object."



I am trying to add a Web reference to a project.  So, I do the standard: right clicking on the project and select "Add Web Reference". The Add Web Reference appears and I navigate to the desired URL "http://ws.melissadata.com/dqws/Address.asmx" and click "Go".   This works in IE.  I see the results and two methods in the window.  However,  the "Add Reference" button and " Web Reference Name" texbox is disabled. And, I see the Operation is not valid due to the current state of the object." I think this is a proxy and or firewall issue?


I know the System.Net.WebProxy("corp-xxx-proxy.xxx", 8080);  and System.Net.NetworkCredential("xxxx", "xxxx"); [x replaces real values]

 Any ideas where I can set this info so I will be able to use the "Add Web Reference" wizard?  - OR - Is there a workaround?




Operation is not valid due to the current state of the object at Microsoft.SharePoint.WebControls.S

I have this  problem. When I run this piece of code all I get is

1. I get this error at SPWebApplication webApp = webAppBld.Create();

2. {"Operation is not valid due to the current state of the object."}

3. Stack gets here "   at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context)

                SPFarm objSpfarm = SPWebService.AdministrationService.Farm;
                SPWebApplicationBuilder webAppBld = null;

                webAppBld = new SPWebApplicationBuilder(objSpfarm);
                webAppBld.Port = 33665;
                webAppBld.Id = System.Guid.NewGuid();

                webAppBld.AllowAnonymousAccess = false;
                webAppBld.UseNTLMExclusively = true;
                webAppBld.UseSecureSocketsLayer = false;

                webAppBld.ApplicationPoolId = "SharePointAppPoolId-33665";
                webAppBld.ApplicationPoolUsername = @"testsvr02\testadmin";

                // build the password as a secure string
                SecureString appPoolPwd = new SecureString();

Operation is not valid due to the current state of the object - while using membership class in shar


My Code for creating an FBA user programatically -




                SPSite osite = SPContext.Current.Site;
                MembershipCreateStatus createStatus;
                MembershipUser Muser=Membership.CreateUser("test", "pass@word1", "test@test.com", "FbaPasswordQuestion", "FbaPasswordAnswer", true, out createStatus);

                SPWeb oweb = osite.OpenWeb();
                oweb.AllowUnsafeUpdates = true;
                if (createStatus == MembershipCreateStatus.Success)

Operation is not valid due to the current state of the object at Membership.CreateUser (FBA) in Shar


I have a SharePoint 2010 Web App configured with Claims Based Authentication (FBA). Whenever my code encounters Membership.CreateUser or any Membership class methods, it gives me the "Operation is not valid due to the current state of the object"  error.

The same Membership Provider code is working fine in a standalone ASP.Net application.


Stsadm Backup/Restore Error! "operation is not valid due to the current state of the object "



I am facing problem while taking a backup of my SharePoint 2010 site using stsadm command after taking 75% backup it shows "operation is not valid due to the current state of the object " error message. While it is working on my different sharepoint server. I am using SharePoint 2010 RTM.

Thanks & Regards, Satish Srivastava

Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state


Hi all,

    I am trying to deploy my first Visual Webpart from Visual Studio 2010 to SharePoint 2010. It contains simple 'Hello World!' message. The project builds successfully, but when I try to deploy it, it gives "Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object"

I have enabled SharePoint Server Publishing Infrastructure in the site collection and site.  

Help please. 


How to update selected item state in the list box by clicking a button?

I created a listbox menu to browse through content by clicking items in the listbox. I also created ‘back’ and ‘forward’ type of navigation to browse through the same content based on the browsing history. I load content into frame and accessing the browsing history with NavigationCommands.BrowseBack and BrowseForward Properties. It is working great. However, I need to indicate a selected state of the listbox item related to the content shown in the frame while browsing with Back/Forward buttons. I have a hard time binding that property. What is the correct way to bind selected state of the listitem in this case? Thank you in advance. XAML: Button <Button x:Name="NavBack" Content="" HorizontalAlignment="Left" Margin="20,0,0,0" Style="{DynamicResource BackButtonStyle}" VerticalAlignment="Top" CommandTarget="{Binding ElementName=ContentFrame}" Command="{x:Static NavigationCommands.BrowseBack}" SnapsToDevicePixels="True" IsEnabled="{Binding CanGoBack, ElementName=ContentFrame, Mode=OneWay}" > XAML: Listsbox <ListBox x:Name="Nav_ListBox" Margin="0,18,0,0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Background="#FFF2F2F2" ItemsSource="

difference between Set Field in Current Item versus Update List Item?

Is there a technical different between Set Field in Current Item and  Update List Item if the field in the item being updated with in the same list the workflow is attached to?  It seems like there wouldn't be any difference - that you could use one or the other.  But I'm having trouble with my workflow.  It completes without error, but the field in my current list item isn't being updated (getting the value from another list in same site).
There are no mistakes; every result tells you something of value about what your are trying to accomplish.

List Item Update Exception from HRESULT: 0x80040E2F Unexpected query execution failure, error code 3


A thread somewhat simliar to this has been posted before as well, but i just wanted to detail out the issue and circumstances

We have a list with 53 columns and 2600 items(and growing. I know its rubbish, but thats the way it is at the moment). The list was created using SharePoint GUI  on a test server, saved as a template with data, and was then imported to the production environment. I can post the list columns and type if it helps.

Every one in a while, on updating an item, SharePoint throws up the very not so helpful error page with "Exception from HRESULT: 0x80040E2F".

We looked into the logs and found that for each suc error, there was a Database level error logged as well.

The error starts with Unexpected query execution failure, error code 3621. Additional error information from SQL Server is included below. "The statement has been terminated." Query text (if available): "BEGIN TRAN;DECLARE... and runs for many lines so i wont post the entire blurb here.

Each time, the item update is successful, despite this error. The list also has an Item Updated event handler attached to it. Every time the update error occurs, the event handler does not seem to be firing.

Anybody can shed light on what is happening. We have tried exporting the list template to another site and everything seemed to work

Exception handling in projects which uses Ajax, ASP.NET, Http Module, MVC3 and Http Handlers


Dear All,

I am working on a project where we have used few of the web application plateforms & techniques. I need to build a robust exception handling framework for my applications that handles all type of exceptions i.e server exception, unhandled exception, http module exception and custom raised exception etc.

In our projects,

1) we have static ASP.net pages (without code behind) for jQuery menus which uses jquery ajax and custom HttpHandler to fetch the data from the server.

2) some aspx pages load and save application data using jQuery ajax and custom httpHandlers.

3) some functionalities are developed in MVC3 which uses strongly and non strongly type views. Strongly type view save the data through controller on page submit and non strongly type view used jQuery ajax and json to save the data from controller.

4) We are also using HttpModule in our web site to authenticate the user.


Please guide me how to handle exception from multiple sources and display custom error message to the user from asp.net pages and jquery ajax calls?

C++ at Work: Persisting View State Update, Using Managed Extensions in a DLL


This month marks the 11th anniversary of my column and the inauguration of a new title: C++ At Work. We're also adding a new bimonthly column, "Pure C++," by my pal Stan Lippman, one of the great C++ Masters.

Paul DiLascia

MSDN Magazine February 2005

Concurrent update in sharepoint list item



How the concurrent for sharepoint list item are are handled.

if two or more users are working on same item. Then how sharepoint process multiple update request for particular list item.

The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database


Hello everybody,


i am encountering an exception in my in my application at these lines of code.


DatabaseProviderFactory dbFactory =

new DatabaseProviderFactory(dataSource);// Create and return a database object.


return dbFactory.Create(name);


i am getting this exception at the create line


The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, 125ba2c1-9573-45be-b8a2-b370deff980d]) failed: Exception has been thrown by the target of an invocation. (Strategy type ConfiguredObjectStrategy, index 2)


I have referenced the proper assemblies in my project and on  other systems, its working fine.

The connection string is DB2.My db2 connection is also good with no issues. My stack Trace

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend