创建计算列. [英] Create calculated columns.
问题描述
亲爱的
我正在尝试使用以下代码从SharePoint 2007中获取计算的列值.
I am trying below code for getting the calculated columns value from SharePoint 2007.
我正在获取DisplyName,Descitption等所有值
I am getting all values like DisplyName, Descitption etc
但是当我使用下面的代码获取公式时,并没有获得确切的公式.
But when I am fetching the formula with below code not getting exact formula.
例如.
如果是原始公式
1. = ABC +(ABC/100)
1. =ABC+(ABC/100)
2. =批准日期+ 100
2. =Approval Date + 100
然后我得到带有代码的以下公式:
Then I am getting below formulas with code:
1. = ABC1 +(ABC/100)
1. =ABC1+(ABC/100)
2. =批准_X0020_日期+ 100
2. =Approval_X0020_Date + 100
如何获取确切的公式?
代码:
foreach($ mlWeb.Lists中的$ list)
{
$ fields = $ list.Fields |?{$ _.Type -eq"calculated"}
if($ fields)
{
foreach($ fields in $ fields)
{
$ formula = $ field.FieldXml.formula;
foreach($list in $mlWeb.Lists)
{
$fields = $list.Fields|?{$_.Type -eq "Calculated"}
if($fields)
{
foreach($field in $fields)
{
$formula = $field.FieldXml.formula;
}
}
}
}
}
}
谢谢
Harish Patil
Harish Patil
推荐答案
请使用下面的PowerShell脚本获取字段公式.
Please use the PowerShell script below to get the formula of fields.
foreach(
列表在
mlWeb.Lists中) {
mlWeb.Lists) {
这篇关于创建计算列.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!