I've created a list programmatically with two site columns (title, name (peoplepicker))
The list show both site columns but when I try to create a new item only the title will show, "name" (people picker) are missing. It's not a content type!
Code for creating the fields:
<Fields>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="$Resources:core,Title;" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" MaxLength="255" />
<Field ID="{12B2742C-2A44-4792-935C-5504B1CC2198}" Type="User" DisplayName="Name" List="UserInfo" Required="FALSE" EnforceUniqueValues="FALSE" UserSelectionScope="0" ShowField="ImnName" UserSelectionMode="PeopleOnly" StaticName="Name1" Name="Name1" />
</Fields>
views example:
<View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="LinkTitleNoMenu"></FieldRef>
<FieldRef Name="Name1"></FieldRef>
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
</ParameterBindings>
</View>
EventReciever:
if (importantRolesList != null)
{
SPList oList = web.Lists[ImportantRolesListName];
SPListItem oSPListItem = oList.Items.Add();
oSPListItem["Title"] = "testitem";
oSPListItem.Update();
var importantrolesWP = new XsltListViewWebPart
{
Title = ImportantRolesListName,
ChromeType = PartChromeType.TitleAndBorder,
ListName = importantRolesList.ID.ToString("B").ToUpper(),
ViewGuid = importantRolesList.DefaultView.ID.ToString("B").ToUpper()
};
webPartManager.AddWebPart(importantrolesWP, RightZoneId, 3);
}