SPFieldLookup "Add a column to show each of these additional fields" 以编程方式
SPFieldLookup "Add a column to show each of these additional fields" programmatically
Additional fields
我想在从 SPField
进行 SPFieldLookup
转换时获取此列表,并另外编辑以显示更多字段。有谁之前经历过这个吗?请帮帮我。
foreach (SPField oSPFieldV2 in olistsubGoc.Fields)
{
if (oSPFieldV2.StaticName.Contains(oField.StaticName + "_x003a_"))
{
try
{
if (olistsub.Fields.TryGetFieldByStaticName(oSPFieldV2.StaticName) == null)
{
SPField tmep = olistsub.Fields.TryGetFieldByStaticName(oField.StaticName);
string depLookUp = olistsub.Fields.AddDependentLookup(oSPFieldV2.StaticName, tmep.Id);
SPFieldLookup fieldDepLookup = (SPFieldLookup)olistsub.Fields.GetFieldByInternalName(depLookUp);
fieldDepLookup.LookupField = oSPFieldV2.StaticName.Replace(oField.StaticName + "_x003a_", "");
fieldDepLookup.Update();
}
}
catch (Exception ex)
{
}
}
}
这是我找到的问题的解决方案。
Additional fields
我想在从 SPField
进行 SPFieldLookup
转换时获取此列表,并另外编辑以显示更多字段。有谁之前经历过这个吗?请帮帮我。
foreach (SPField oSPFieldV2 in olistsubGoc.Fields)
{
if (oSPFieldV2.StaticName.Contains(oField.StaticName + "_x003a_"))
{
try
{
if (olistsub.Fields.TryGetFieldByStaticName(oSPFieldV2.StaticName) == null)
{
SPField tmep = olistsub.Fields.TryGetFieldByStaticName(oField.StaticName);
string depLookUp = olistsub.Fields.AddDependentLookup(oSPFieldV2.StaticName, tmep.Id);
SPFieldLookup fieldDepLookup = (SPFieldLookup)olistsub.Fields.GetFieldByInternalName(depLookUp);
fieldDepLookup.LookupField = oSPFieldV2.StaticName.Replace(oField.StaticName + "_x003a_", "");
fieldDepLookup.Update();
}
}
catch (Exception ex)
{
}
}
}
这是我找到的问题的解决方案。