Getting Error In Item Added Event In Event Receiver in SharePoint 2010

Hi Guys,
I have written Event Receiver in SharePoint 2010 On ItemAdded event of Document Library. Wants to increment a col value by reading maximum value first. I wrote below code but sometime it works correctly but some time I got below error: Document Set
enabled on this document library and weh we added any document in any document set then this event occurred. I mentioned Code block and Error description both.
Please see and suggest right solution.
Code:
public override void ItemAdded(SPItemEventProperties properties)
                base.ItemAdded(properties);
                SPListItem _currentItem = properties.ListItem;
                string _QUERY = @"<Where><Eq><FieldRef Name='DocumentId'/><Value Type='Text'>21</Value></Eq></Where><OrderBy><FieldRef
Name='RevisionReference' Ascending='False' /></OrderBy><ViewFields><FieldRef Name='RevisionReference' /></ViewFields><QueryOptions><Folder>DocumentLIBB/</Folder></QueryOptions>";
                int maxID = 0;
                string revisionreferencee = string.Empty;
                using (SPWeb web = properties.OpenWeb())
                    SPList list = web.Lists["DocumentLIBB"];
                    SPQuery query = new SPQuery();
                    query.ViewAttributes = "Scope=\"Recursive\"";
                    query.Query = (_QUERY);
                    SPListItemCollection results = list.GetItems(query);
                 if (results.Count > 0)
                        SPListItem item = results[0];
                        revisionreferencee = item["RevisionReference"].ToString();
                        bool result = Int32.TryParse(revisionreferencee, out maxID);
                        _currentItem["RevisionReference"] = maxID + 1;
                        _currentItem["DocumentId"] = item["DocumentId"].ToString();
                properties.ListItem.File.Update();
                _currentItem.Update();
Error Desc:
<nativehr>0x81020015</nativehr><nativestack></nativestack>The file EKENg LIBB/QA_DOC_044/05-22 Emirates Engineering Occurrence_Error Investigation - MEDA Process - 27 AUG 2009-921.doc has been modified by SHAREPOINT\system
on 27 Aug 2012 12:10:13 +0400.
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>0x81020015</nativehr><nativestack></nativestack>The file EKENg LIBB/QA_DOC_044/05-22 Emirates Engineering Occurrence_Error Investigation - MEDA
Process - 27 AUG 2009-921.doc has been modified by SHAREPOINT\system on 27 Aug 2012 12:10:13 +0400.
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. 

Making the event synchronous (rather than the default) eliminates this error. If such a change suits your requirements you should consider it. You just have to tweak the elements.xml in your feature receiver project;
http://blogs.msdn.com/b/unsharepoint/archive/2010/11/10/sharepoint-event-receivers-making-asynchronous-event-synchronous-to-avoid-save-conflict-error.aspx
w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | c: http://www.b-i.com

Similar Messages

  • Conflict between Client object model and Item Updated Event Receiver in sharepoint 2010

    Hello All,
    As per my requirement I have a two custom list.
    Agent Details
    Port Name
    Agent Details contains Agent code, Port Name,  email, address and phone of Agent. Its possible that one Agent Code is connected with multiple Port Name.
    Basically what I am doing is I am getting port name connected with Agent code, using jquery and bind those values with check box(using javascript created dynamically) and bind all with Div tag.
    Now when my custom edit form of Agent list open up it shows me different port name binding with checkbox group.
    when user select the check box and click confirm button my clicent object model script will run and add this selected value into Port Name list. 
    After confirm one more button named Save will enable asking user to edit the email, phone or address value and when I click on save my Item updated event fires which update the values of the selected port name(These port name I am getting from port
    name list) to Agent Details custom list.
    Now when I am trying to update the values my event receiver fires or some times it got stuck(not firing). So could you please help me the possible alternative for this requirements.
    Can we user the Ecma Script(Client object model to preserve the value of selectec port) and Item updated event receiver on the same time?
    Is anything am doing wrong then please guide me.

    Hi,
    As I understand, when you updated values in the agent details list the Item updated event receiver got stuck sometimes.
    The item update event receiver will fire after the item has been saved, and the client object model script or the Ecma Script runs before the item is saved, so there is no conflict between the client object model script and item update event receiver.
    You could find out the reason about the item update event receiver gets stuck by debugging the event receiver.
    When you want to debug your event receivers, you have to attach to OWSTIMER.EXE and wait till they are executed. You can control this behavior using the Synchronization attribute. Also, if you’re looking for an easy way to debug an event receiver without
    having to manually attach a debugger to your code, you can use the System.Diagnostics.Debugger.Launch() method.
    The articles below are about how to debug in the event receiver in SharePoint 2010.
    http://sharepoint-kings.blogspot.jp/2013/02/debugging-event-receivers-in-sharepoint.html
    http://chakkaradeep.com/index.php/event-receivers-in-sharepoint-2010/
    http://sharesaint.com/?p=77
    Best regards,
    Sara Fan
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to get column values on item added event receiver

    Hi,
    I have two columns in a document library and one is people or group column and the other one is choice column with check boxes.
    I want to know how to read column values on Item Added event receiver, so that I can create if statements based on those values.
    Thank you,
    AA.

    Hi AOK2013, 
    Have you had a look at this Microsoft tutorial: http://msdn.microsoft.com/en-us/library/office/gg981880(v=office.14).aspx
    Essentially, you want to use the AfterProperties property to access the changed field value. 
    E.g. 
    var personvalue = properties.AfterProperties["YourPersonFieldName"]
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Handling ItemAdding Event in event receiver in sharepoint 2010.

    public override void ItemAdding(SPItemEventProperties properties)
    base.ItemAdding(properties);
    SPItem itemBeingAdded = properties.ListItem;
    var startTime = itemBeingAdded["Start Time"]; // does not give any value
    // Some code goes here.
    I am firing this event while adding an item in a calender list. It is getting fired. No problem. But I am not getting any value from properties.
    In the above code startTime gives
    me nothing. Actually, I want to access the column field of the item (properties in
    my case) is being added.
     Problem is in the ItemAdding method.
    ItemUpdating is working fine.
    public override void ItemUpdating(SPItemEventProperties properties)
    base.ItemUpdating(properties);
    SPItem itemBeingAdded = properties.ListItem;
    var startTime = itemBeingAdded["Start Time"]; //always gives me value
    How can I do it in ItemAdding method. 

    Use AfterProperties instead.
    http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.spitemeventproperties.afterproperties(v=office.15).aspx
    http://srisharepointdevelopment.blogspot.com/2013/06/beforeproperties-and-afterproperties-in.html
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • I am trying to install iTunes 12.0 on my Windows 7 PC to sync my iPhone6. I am getting error message, "Item already exists" on installation of iTunes 12.0.  Apple has no fix. Help???

    I am trying to install iTunes 12.0 on my Windows 7 PC to sync my iPhone6. I am getting error message, "Item already exists" on installation of iTunes 12.0.  Apple has no fix. Help???

    Item or object?
    For "Object already exists" or "Access denied" errors when installing try opening Control Panel > Programs and Features > View installed updates then checking for Security Update for Microsoft Windows (KB2918614). Uninstall if you have it, then reboot and try installing again.
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • Getting error while tring to Check in any document in Sharepoint 2007. Error - "Unable to validate data. System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) ...

    Hi Team,
    I am getting error while tring to Check in any document in Sharepoint 2007. Error - "Unable to validate data. System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength).
    Anybody please let me know how to resolve the issue. It has affected our 9 site collection with almost 2000+ sites. Please email me your your suggestion or you can share your ideas here also.
    Tried to reset the IIS, checked the Internet connection speed (8MBps). Cleared the cache and all but no luck.
    Thanks,
    Pronob

    Hello,
    I have found this support window for you:
    http://support.microsoft.com/kb/556031
    http://technet.microsoft.com/en-in/library/cc298582%28v=office.12%29.aspx
    This may help you
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Getting error  while calling triggering event in processFormRequest

    hi all,
    i am clicking my custom button after selecting value from a lov on create quote and getting error "Row 1 Error - Please note that following required fields have not been entered: CustPartyId "
    if 1st i m entering a value in DFF filed and then selecting value from lov and cliking my custom button this error is not coming.
    please help.
    thanks

    hi all,
    i am clicking my custom button after selecting value from a lov on create quote and getting error "Row 1 Error - Please note that following required fields have not been entered: CustPartyId "
    if 1st i m entering a value in DFF filed and then selecting value from lov and cliking my custom button this error is not coming.
    please help.
    thanks

  • Getting error message when adding on account payment in Outgoing Payments

    Hi,
    We are getting error message "No Matching records found 'Sales Tax Authorities Type' (OSTT) (ODBC - 2028) [ Message 131 - 183]" when we are trying to add account payment in Outgoing Payments. We are not getting any errors while adding customer payments or vendor payments. Please give us the solution. 
    Version : SAP 2007B SP:00 PL:00
    Thanks,
    Sravan Kumar Pothu

    Hi Jeyakanthan,
    Thanks for your immediate reply.
    Actually in outgoing payments there is no tax code selection available. Just we simply selecting the account on which we are making payment and amount( in payment means we are giving cheque details). When trying to add it is giving above said error. Kindly let me know if you have any solution.
    Thanks,
    Sravan Kumar Pothu

  • BAPI_PO_CREATE1 - How to get error PO item number

    All,
    I am using BAPI_PO_CREATE1. When PO is errored out, RETURN structure returns PO number with list of errors and warnings.
    It says, 'PO contains still faulty items'  but does not return specific item number.
    I need error PO item number too. Any help?
    Thanks,
    SKJ

    In the RETURN table which is of BAPIRET2 structure, there are 2 fields PARAMETER, ROW. Parameter gives the Table name which has the error and the ROW field gives the row number in that particular table. for eg: PARAMTER = 'POITEM'  and ROW = '2' means the error corresponds to line number 2 in the POITEM table.
    If these 2 fields are not populated, then it is an error in the header
    Hope this helps,
    Regards,
    Hari

  • Make coded ui tests wait for onfocus event during playback - SharePoint 2010 InfoPath form

    I recorded a coded UI test of a SharePoint 2010 site hosting an InfoPath form. The combobox on the infopath form loads the items on onfocus event. It seems that the  coded ui test do not wait for the onfocus event to complete and tries to select the
    item and fails with the error
    The web page could not be accessed. If the page is refreshing, please wait until the page refreshes and then perform actions on it. 
    how can i make the Test to wait till it completes the onfocus event and then select the item.
    one approach i applied was  
    bool bReady = false;while (!bReady)
    try
    uID4ComboBox1.WaitForControlReady();
    // Select 'RMA2' in 'D4' combo box
    uID4ComboBox1.SelectedItem =this.CreateProposalParams.UID18ComboBox1SelectedItem;
    bReady =true;
    catch
    Playback.Wait(1000);
    But i have a lot of combo boxes which makes this solution difficult to implement.
    Thanks in advance.

  • Email through Event receiver in SharePoint Online

    Hi,
    I am creating an event receiver for custom list which will send email to users in sharepoint online.
    I am using the following code to send email through event receivers in sharepoint.
                MailMessage mMailMessage = new MailMessage();
                mMailMessage.From = new MailAddress("[email protected]");
                mMailMessage.To.Add(new MailAddress("[email protected]));
                mMailMessage.Subject = "subject1";
                mMailMessage.Body = "just a body";
                mMailMessage.IsBodyHtml = true;
                SmtpClient client = new SmtpClient("smtp.office365.com", 587)
                    Credentials = new NetworkCredential("[email protected]", "****"),
                    EnableSsl = true,
                   UseDefaultCredentials = false,
              client.Send(mMailMessage);
    NOTE: I am using MailMessage() because it is in the sandbox solution.
    However I am facing the following error :
    Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=4.0.0.0,
    Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    It may be because I am trying to use SMTP server of sharepoint Online,However I am not able to connect it.
    Can anybody help me and can advice how to send email programmatically from sharePoint online ?
    Thanks
    Jhalak

    In Office 365, there's no direct way to send an email programmatically because the SPUtility.SendEmail
    Method isn't available in sandboxed solutions. The workaround is to use the Send an Email action in a list workflow.
    For further detail: http://visualstudiomagazine.com/blogs/tool-tracker/2012/04/send-an-email-in-office-365.aspx

  • Exchange Server 2010 public folder - Events show in SharePoint 2010 Calendar

    I want to fetch items to SharePoint 2010 Calendar from Exchange Server 2010 Public Folder Calendar called Event. How can I achieve this ?

    May be you can directly fetch whole public folder in sharepoint server
    http://www.amrein.com/apps/page.asp?Q=5778
    If this helped you resolve your issue, please mark it Answered

  • I am getting I am getting nativehr 0x80070057 /nativehr nativestack /nativestack error when I change my publishing page layout in SharePoint 2010.

    Hello All,
    I am getting the following error when I tried to change the page layout of a publishing page in my site collection using SharePoint 2010.
      Here I am just trying to change the page layout to "Four Item Grid" page layout. But i am not sure why this error is coming up.
    I tried to search in the internet but no one has this kind of issue it seems.
     Can anybody help me in resolving this issue.

    I had this same problem when trying to change the layout on a publishing page.
    What I found by running some powershell script against the pages library is that the ows_PublishingPageLayout field actually referenced a layout url from another site. What had happend is that an author downloaded a copy of a page from one site and
    uploaded it to another site. Evidently when you do this the url reference to the page layout file does not get corrected (it's fully qualified)
    To fix this problem I wrote some powershell script to update the ows_PublishingPageLayout url so the site host url was corrected and did not have the old/original site's url.
        $SiteUrl = "http://your.site.url.here"
        $SPSite = New-Object Microsoft.SharePoint.SPSite($SiteUrl); 
        $OpenWeb = $SpSite.OpenWeb(); 
        $publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($OpenWeb)    
        $AllPubLayouts = $publishingWeb.GetAvailablePageLayouts()
        $pages = $OpenWeb.Lists["Pages"]
       #view all page layouts
       foreach ($page in $pages.Items)
            if (!$page["ows_PublishingPageLayout"].ToString().Contains($SiteUrl))
                write-host $page.url
                write-host $page["ows_PublishingPageLayout"]    

  • Getting error RVTBM-008 and RVTBM-120 during receiving RMA line

    Hello,
    Initially we tried to receive the RMA line but here we forgot to setup the lot number hence i am getting error when i was run the receiving transaction processor.
    Then i put the correct LOT number and again delete all the lines from 'Receiving Transaction Summary' and tried to receive the RMA line in Inventory but i am getting below error when the Receiving Transaction Processor run.
    Concurrent program RVCTP returned error
    Cause: RVCTP encountered an internal error. Parameters: RVCTP,IMMEDIATE,584656,
    Action: Note both this error number and the actions you are trying to perform. Contact your system ad
    RVTBM-008: Subroutine rvtbm_immediate_mngr() returned error
    Cause: Subroutine rvtbm_immediate_mngr() returned an internal error.
    Action: Note this error number and the actions you are trying to perform. Contact your syste
    RVTBM-120: Subroutine rvtptcontrol() returned error
    Cause: Subroutine rvtptcontrol() returned an internal error.
    Action: Note this error number and the actions you are trying to perform. Contact your system administrator
    Concurrent Manager encountered an error while attempting to start your immediate concurrent program RVCTP. Routine &ROUTINE received a return code of failure.
    Contact your support representative.
    I am using Apps version-12.0.6
    Please help me to rectify this issue.
    Thanks,
    Rajesh

    Action: Note both this error number and the actions you are trying to perform. Contact your system ad
    RVTBM-008: Subroutine rvtbm_immediate_mngr() returned error
    Cause: Subroutine rvtbm_immediate_mngr() returned an internal error.
    Action: Note this error number and the actions you are trying to perform. Contact your syste
    RVTBM-120: Subroutine rvtptcontrol() returned errorSearch MOS for the above two errors and go through the docs.
    RMA Deliver Transactions Stuck in RVCTP With RVTPT-020: Rvtoe_rmapushapi() [ID 278993.1]
    UNABLE TO MAKE RECEIPTS AGAINST RMA User-Defined Exception in Package [ID 1082586.1]
    RCVRCERC: Some RMAs fail with RVTBM-008: Subroutine rvtbm_immediate_mngr() returned error [ID 738890.1]
    RVTII-030 rvtiicreate() When Receiving some RMA [ID 371464.1]
    RVTBM-008: Subroutine rvtbm_immediate_mngr() returned error in Depot Repair Bulk Receiving [ID 1301960.1]
    Thanks,
    Hussein

  • Send a list item as a bulk e-mail using SharePoint 2010

    My scenario is to e-mail newsletters to a group of users (running into 1000's) and we were thinking about any pro's and cons of using SharePoint here.
    Preferable if the newsletter were embedded in the e-mail so there is no need to give permission to a user to visit the site (or do we have to anyway?)
    Also, a functionality such that, every list item could have an option such as "E-mail to Group 1" or "Email to Group 2" that would allow the item to be mass e-mailed.
    Group 1 assume to be a group of 500 individuals with only e-mail addresses known...
    If SharePoint seems right, then can anyone suggest me how to go about this? If it is possible with OOTB/designer?

    For you scenario, you could explore ECB Menu action using SharePoint designer.
    The logic would be first fire up SharePoint designer and create an ECB menu to start a workflow ie initiate workflow in SharePoint designer (you need to create two workflows each for Group1 and Group2 to make it simple)
    Next step would be to create a workflow to send an email to the selected group and use item values within the workflow to create the newletter.
    here are some reference on how to -
    http://sharepointyankee.com/2009/12/19/adding-custom-actions-to-the-list-item-menu-in-sharepoint-2010-using-sharepoint-designer-2010/
    http://blog-sharepoint.blogspot.com/2011/10/tutorial-add-custom-list-actions-using.html
    http://office.microsoft.com/en-us/sharepoint-designer-help/send-e-mail-in-a-workflow-HA010239042.aspx
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

Maybe you are looking for

  • Reset an Dunning Wizard / Rework

    Hi all, is it possible to reset an Dunning  Wizard run ? If an customer do an dunning wizard run and after the execution he see that something is wrong is there a chance to reset /rework the dunning run ? Kind regards Gerhard Bienen

  • HT3825 Sony Nex 5 Raw, 10.6.8 and iPhoto 09

    I am very frustrated.  According to this post, I should be able to use the Digital Camera Raw3.9 updater on 10.6.8. I have iPhoto 09.  It tells me I need 'iPhoto 9'.  iPhoto 11 (v 9) will not run on 10.6.8, but only on 10.7.  This doesn't make sense.

  • What i have done wrong: I got the information "no bootable device insert boot disk and press any key

    I use yesterday bootcamp to instal windows 7 at my mac. After i had start bootcamp, i instaled windows, particion my hard driver, and restart my computer. After i had restarted my computer, i got a black screan with the information: no bootable devic

  • Cockpit doesnu0092t work (SAP AII 4.0) - Error in JCO connection

    Hi all, After some days working with the "Cockpit" in AII 4.0, today we can not access to it and we don’t know why. When we execute the transaction “/AIN/DTUIURL - Auto-ID Cockpit”, we do logon and after that it appears the error: "Failed to process

  • RAM gets used up too quickly - any ideas?

    I am sure this is a problem which can be solved quickly by one of the many very knowledgeable guys out there: I have a 2007 MacPro 2.66 Dual core with 8 Gb RAM (well out of date I know) but this is the problem. After booting up with no other programm