SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to update formula of calculated field. I wrote method for that, it is working fine and is updating formula as well. But it takes really long time to update formula in large library ie library with more than 5000 documents.

    private void changeFormulaForThisField(SPField field, String newFormula)
        if (field.Type == SPFieldType.Calculated)
            SPFieldCalculated calcField = (SPFieldCalculated)field;

            if (calcField.Formula == newFormula)
                writeLogMessage("Column [" + field.Title + "], Old and new formula same");
                calcField.Formula = newFormula;

                if (!TESTMODE)

                writeLogMessage("Column [" + field.Title + "], updating formula...done");

I checked doing same ie updating formula using SharePoint UI. It seems it also depends on number of documents in library. For small library, it is really fast. For large library, it takes also long time in UI, but not so long as using my code.

Am I doing something wrong or inefficient way in my code ? Does updating formula/title for one spfield also needs to update formula/title for each items or what ? Have you experienced such behaviour before ?

Any response would be helpful.


share|improve this question

Calculated columns in SharePoint are precalculated, the assumption being that they are going to be used a lot more than changed.

So when you change the formula SharePoint has to update the calculated value in each item.

share|improve this answer
ok, then it makes sense for Calculated Columns. But do you have some article that mentions this ? It would be helpful. Also, it takes long time for changing titles using resources (for 2 languages) in large lists ? – newcoderintown May 31 '12 at 19:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.