2

I need to create a calculated item , which has: the ID of the item, the created date and title. How to do this combination in xml. i tried this code :

<Field Type="Calculated"  DisplayName="$Resources:SiteColumns,Calculated_Title" EnforceUniqueValues="FALSE" Indexed="FALSE" 
         Format="DateOnly" LCID="1033" ResultType="Text" ReadOnly="TRUE" ID="{bc7b5078-a90d-47e3-b0fc-8d87c0a0721d}" 
         SourceID="{d10a9f52-13ca-4392-9f51-c0f25b0b929a}" StaticName="Calculated_Title" Name="Calculated_Title"  ColName="sql_variant1" RowOrdinal="0" Required="FALSE" Version="13">
    <Formula>=Title&amp;" num : "&amp;ID&amp;" créer a "&amp;TEXT(Created,"d-mmm-yyyy  hh:ss")</Formula>
    <FieldRefs>
      <FieldRef Name="Created" />
      <FieldRef Name="ID" />
      <FieldRef Name="Title" />
    </FieldRefs>
  </Field>

it doesnt work with visual studio.

but if i use the OOB,with this fomula it works fine the formular :

=Title&" num : "&ID&" créer a "&TEXT(Created,"d-mmm-yyyy  hh:ss")

so how to do it to have a programmaticaly calcualted filed, with correct formula using the XML.

  • Can you try Author instead CreatedBy? – newbie Sep 20 '17 at 11:12
1

You can not write the ID field, it is set by SharePoint after the Item is created in the SQL server database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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