我正在使用我在 SharePoint 中构建的自定义列表。我有一个功能,它有一个事件处理程序,当该功能被激活时会启动。该事件处理程序调用(我可以调试并观察它执行)以下函数:
我打算让函数的行为如此处所述。
private void OrderFields(SPWeb web)
{
// This works fine: I get the expected SPContentType object
// There is only 1 SPContentType in ContentTypes
SPContentType contentType = web.Lists[TASK_LIST_NAME].ContentTypes[0];
contentType.FieldLinks.Reorder(new string[4]
{
"Field1",
"Field2",
"Field3",
"Field4"
});
contentType.Update();
}
OrderFields
调用调用的函数web.Update();
也是如此。
不幸的是,重新排序调用不会重新排序表单上的字段。我错过了什么吗?任何人都可以建议我可以尝试的任何技巧吗?