如何在没有列表定义的情况下将列表列添加到列表实例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在没有列表定义的情况下将列表列添加到列表实例相关的知识,希望对你有一定的参考价值。
列出实例Elements.xml文件:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="listname"
OnQuickLaunch="TRUE"
TemplateType="100"
FeatureId="00bfea71-de22-43b2-a848-xxXxxxXxx"
Url="Lists/listname"
Description="">
</ListInstance>
</Elements>
只有这一个文件可用时才可以添加列吗?或者我被迫使用列表定义?
答案
将新文件添加到名为Schema.xml的列表实例中。 把代码:
<?xml version="1.0" encoding="utf-8" ?>
<List xmlns:ows="Microsoft SharePoint" Title="listname" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/listname" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
<ContentType ID="0x01" Name="Item" Group="List Content Types" Description="Create a new list item." Overwrite="TRUE" FeatureId="{d725a6e2-53f9-40f6-897a-d0e6a05f9588}">
<Folder TargetName="Item" />
<FieldRefs>
<FieldRef Name="LinkTitleNoMenu"></FieldRef>
<FieldRef Name="LinkTitle"></FieldRef>
<FieldRef Name="Title"/>
<FieldRef ID="{07BCD344-0A65-4201-BB9F-302C52EA326C}" Name="User" DisplayName="User"/>
</FieldRefs>
</ContentType>
</ContentTypes>
<Fields>
<Field ID="{2C5C4E9D-91D8-4995-8B08-20F323E42DF2}" Name="LinkTitle" DisplayName="Title" Type="Text"></Field>
<Field ID="{D9B62993-78E7-45D0-BD1A-5DAE2C87E84A}" Name="LinkTitleNoMenu" DisplayName="Title" Type="Text"></Field>
<Field ID="{34124B16-F636-4894-92C1-22BDCAA6FAFE}" Name="Title" DisplayName="Title" Type="Text" Required="TRUE"></Field>
<Field ID="{07BCD344-0A65-4201-BB9F-302C52EA326C}" Name="User" DisplayName="User" Type ="Text"></Field>
</Fields>
<Views>
<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 ID="{07BCD344-0A65-4201-BB9F-302C52EA326C}" Name="Value" DisplayName="Value"/>
</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>
<View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pagesviewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="LinkTitle"></FieldRef>
<FieldRef ID="{07BCD344-0A65-4201-BB9F-302C52EA326C}" Name="User" DisplayName="User"/>
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="ID"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
</ParameterBindings>
</View>
</Views>
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pagesform.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pagesform.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pagesform.aspx" WebPartZoneID="Main" />
</Forms>
</MetaData>
</List>
<br/>
不要更改3个字段LinkTitle,LinkTitleNoMenu,Title。 在用户下添加新字段并更改新添加字段的GUID。 像在映像中一样更改Schema.xml文件的属性。
以上是关于如何在没有列表定义的情况下将列表列添加到列表实例的主要内容,如果未能解决你的问题,请参考以下文章