如何以编程方式创建计算字段 [英] how to create a calculated fields programmatically

查看:75
本文介绍了如何以编程方式创建计算字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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   Name="Calculated_Title"    Required="FALSE"
            Type="Calculated"
            DisplayName="$Resources:SiteColumns,Calculated_Title"                     
            ResultType="Text"
            ReadOnly="TRUE"
            ID="{D76D5CDB-B49A-4133-A64B-C98FC9E8CDD4}"            
            Group="SITEP Site Columns"
            >
    <Formula>=Title +" num : "+ID+" créer a "+TEXT(Created,"d-mmm-yyyy  hh:ss")</Formula>
  </Field>

it doesnt work with visual studio.

但是,如果我使用OOB,则该公式可以很好地满足配方设计师的需求:

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.

推荐答案

也许您应该使用显示名称在气孔中.

Maybe you should use the display name in fomula.

https://sharepoint.stackexchange .com/questions/34298/how-can-i-provision-a-list-with-acalculatedfield


这篇关于如何以编程方式创建计算字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆