Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8451725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:18:58+00:00 2026-06-10T11:18:58+00:00

I have a block of code where I’m trying to disable event firing when

  • 0

I have a block of code where I’m trying to disable event firing when editing a file, once the debugger hits the item.SystemUpdate(false) line it throws an exception that states “The file xxxx has been modified by xxxxx”

HandleEventsFiring handle = new HandleEventsFiring();
handle.DisableHandleEventFiring();
   try
   {
      web.AllowUnsafeUpdates = true;

      SPFile rptFile = web.GetFile(item.Url); //item is an SPListItem
      if (rptFile.Exists)
      {
         WordDocUtility word = new WordDocUtility();
         using (System.IO.Stream stream = rptFile.OpenBinaryStream())
         {
               word.ReplaceKeys(stream, keys);
               rptFile.SaveBinary(stream);
         }
      }

        item.SystemUpdate(false); // the line throwing the exception
    }
    finally
    {
      handle.EnableHandleEventFiring();
      web.AllowUnsafeUpdates = allowUnsafeUpdates;
    }

    public class HandleEventsFiring: SPItemEventReceiver
    {
        public void DisableHandleEventFiring()
        {
            this.EventFiringEnabled = false;
        }

        public void EnableHandleEventFiring()
        {
            this.EventFiringEnabled = true;
        }

    }

Does anyone know of a way around this or am I doing something wrong?

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:18:59+00:00Added an answer on June 10, 2026 at 11:18 am

    You haven’t really shown enough of the code for us to point you to the exact problem. The error that you’re getting means that after you pulled the list item that is in item from the content database it was later updated. Chances are, if you get the error every single time, that you’re pulling down the same item more than once and your changes are conflicting with yourself. My guess is that item represents a file in a document library, and that you’re modifying the file in addition to the splist item. These changes are what are conflicting. You need to fetch the item, update the item, then fetch the file and update the file. If you need to fetch the item and then update the file you will need to fetch the item again so that you don’t end up updating an item when another update occurred between the fetch and update.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a block of code that works great in 32bit, and I'm trying
I am trying to have a block of code run 2 seconds after I
So I have this block of code. Basically, I'm taking file $i, checking if
I'm trying to create a Rails app template I have this block of code
Let's say I have a block of code that is copied from one file
I have a block of code in C like this- enum colors { //---->I
I have this block of code inside a loop: var points = [new google.maps.LatLng(lat1,
I have a block of code in my view like this: <% @map[value].each do
I have a block of code that serializes a type into a Html tag.
I have this block of code where when I hover (click for purposes of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.