I am trying to create calculated column using csom.

var fieldXml="<Field Name='calctest' DisplayName='calctest' StaticName='calctest' Type='Calculated' Required='FALSE' ColName='sql_variant1' Format='DateOnly' EnforceUniqueValues='FALSE' Description='weg' Indexed='FALSE' ResultType='DateTime' ReadOnly='TRUE' LCID='1033' Version='2' ><Formula>=DATE(YEAR(Approval_x0020_Date)+3,MONTH(Approval_x0020_Date)+1,DAY(Approval_x0020_Date)+5)</Formula><FormulaDisplayNames>=DATE(YEAR([Approval Date])+3,MONTH([Approval Date])+1,DAY([Approval Date])+5)</FormulaDisplayNames><FieldRefs><FieldRef Name="Approval_x0020_Date" /></FieldRefs></Field>";
olist.Fields.AddFieldAsXml(fieldXml, true, AddFieldOptions.AddToDefaultContentType);

After executing i am getting Error:

The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.

when i am running same code just changing column in formula, it runs smoothly and creates calculated column perfectly.

i.e If i Use Column name=Approval Date (Static name="Approval_x0020_Date"), it will throw above error.

If I use Column name=ApprovalDate (Static name="ApprovalDate"), it will work fine.

Does anyone know why it is not accepting 2 or more than 2 words of column name.

Thanks in advance.

3 Answers 3


Finally i got solution.

I replaced [Approval_x0020_Date] with [Approval Date]. i.e with display name.

Thanks Submits

  • Strange! In my case I have to use the internal name, after having tried display name. We love SharePoint.
    – Submits
    May 27, 2016 at 15:09

Try putting the column name in square brackets like [Approval_x0020_Date].

The name should be the internal name of the column.

  • Tried. not working, it gives same error
    – Anil Pal
    May 27, 2016 at 14:32

I replicated this issue :

  1. I created site column
  2. Added the site column to a list
  3. Created a Calculated field, as site column
  4. It'll tell me the column doesnt exist

Solution :

  1. Create a column inside the list instead

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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