1
我創建了一個包含cumstom字段的列表(sharepoint 2010)。自定義字段繼承自SPFieldUser。 我創建了一個新的ListItem(webfrontend)並查看了元素的詳細信息後,該字段爲空。自定義字段不保存
Webfronted NewItemForm Webfronted ItemDetailsForm Webfronted EditItemForm
我的代碼:
public class Vertreter_FieldType:SPFieldUser
{
public Vertreter_FieldType(SPFieldCollection fields, string fieldName)
: base(fields, fieldName)
{
}
public Vertreter_FieldType(SPFieldCollection fields, string typeName, string fieldName)
: base(fields, typeName, fieldName)
{
}
public override object GetFieldValue(string value)
{
return base.GetFieldValue(value);
}
public override string DefaultValue
{
get
{
return base.DefaultValue;
}
set
{
base.DefaultValue = value;
}
}
}
XML-的fldtypes:
<FieldTypes>
<FieldType>
<Field Name="TypeName">Vertreter_FieldType</Field>
<Field Name="ParentType">User</Field>
<Field Name="TypeDisplayName">Vertreter</Field>
<Field Name="TypeShortDescription">Auswahl Vertreter</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="FieldTypeClass">CustomFieldTypes.Vertreter_FieldType, $SharePoint.Project.AssemblyFullName$</Field>
</FieldType>
</FieldTypes>
我的contentType名單基地上:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
...
<Field ID="{2C338272-3BC8-45bc-B33E-5FBD1223F398}"
DisplayName="Administrator" Name="Administrator"
Type="Admin_FieldType" Required="TRUE"
UnlimitedLengthInDocumentLibrary="FALSE"
/>
<Field ID="{585CE72A-72D7-4ecc-8324-484BA1E483F1}"
DisplayName="Vertreter" Name="Vertreter"
Type="Vertreter_FieldType" Required="TRUE"
UnlimitedLengthInDocumentLibrary="FALSE"
>
</Field>
...
<FieldRefs>
...
<FieldRef ID="{2C338272-3BC8-45bc-B33E-5FBD1223F398}" Name="Administrator" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<FieldRef ID="{585CE72A-72D7-4ecc-8324-484BA1E483F1}" Name="Vertreter" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
...
</FieldRefs>
</ContentType>
</Elements>
我的環境:SharePoint 2010中,VisualStudio的2010
感謝您的幫助!
您應該將您的答案標記爲解決方案。 – 2012-04-26 18:46:53