SharePoint - get value of calculated field without manual parsing

前端 未结 2 1699
一向
一向 2020-12-17 19:56

I have a calculated field in a list with this formula:
=CID & \" - \" & Title

When viewing the list, it might display as: \"2 - Big Meeting\

2条回答
  •  青春惊慌失措
    2020-12-17 20:20

    The answer given by @Nathan does not specify that you need to provide the display name of the field. It wont work with internalName. Moreover, I'm likely to use as to cast the result.

    var cf = list.Fields["calculatedfieldDisplayName"] as  SPFieldCalculated;
    String value = cf.GetFieldValueAsText(item["calculatedfieldDisplayName"]);
    

提交回复
热议问题