zoukankan      html  css  js  c++  java
  • 1.sharepoint列表定义

    我习惯将列表定义单独放大一个project里。

    1.建一个sharepoint solution名为sharepointtest。

    2.然后再解决方案里建一个List Definition 类型的sharepoint项目,取名为SharepointTest.Lists。

    3.在SharepointTest.Lists中新建一个List Definition,取名为ListDefinitionTest。列表定义类型选择自定义列表,选择添加列表实例。如图1

    图1

    4.打开ListDefinetionTest下的Elements.xml(不是ListInstance1下的xml),改为如下情形

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
        <!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List Definition project item, an error will occur when the project is run. -->
        <ListTemplate
            Name="ListDefinitionTest"
            Type="10040"
            BaseType="0"
            OnQuickLaunch="TRUE"
            SecurityBits="11"
            Sequence="410"
            DisplayName="ListDefineTest"
            Description="My List Definition"
            Image="/_layouts/images/itgen.png"/>
    </Elements>

    注意Type的值不要重复。

    5.打开ListInstance1下的 Elements.xml,改为如下情形

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <ListInstance Title="测试列表"
                    OnQuickLaunch="TRUE"
                    TemplateType="10040"
                    Url="Lists/SharepointTest"
                    Description="这是我的测试列表">
      </ListInstance>
    </Elements>

    注意TemplateType的值要同上文中的相同

    6.打开schemal.xml,在<Fields></Fields>添加栏定义,如下文

    <Field ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E1}" Name="Title" DisplayName="标题" Required="FALSE" Type="Text" StaticName="Title" />
          <Field ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E2}" Name="LinkTitleNoMenu" DisplayName="标题" ReadOnly="TRUE" Type="Computed" Dir="" DisplayNameSrcField="Title" AuthoringInfo="(链接到项目)" EnableLookup="TRUE" ListItemMenuAllowed="Prohibited" LinkToItemAllowed="Prohibited" StaticName="LinkTitleNoMenu" />
          <Field ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E3}" Name="LinkTitle" DisplayName="标题" ReadOnly="TRUE" Type="Computed" DisplayNameSrcField="Title" ClassInfo="Menu" AuthoringInfo="(链接到带编辑菜单的项目)" ListItemMenuAllowed="Required" LinkToItemAllowed="Prohibited" StaticName="LinkTitle" />
    <Field ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E4}" Name="Test" DisplayName ="测试栏" Type="Text" />
    <Field ID="{47539D90-EB9B-45A5-8591-68077530FD92}" Name="Field_TaxonomyDemo" StaticName="Field_TaxonomyDemo" DisplayName="TaxonomyDemo" Required="FALSE" Group="Custom group" Type="TaxonomyFieldType">
            <Customization>
              <ArrayOfProperty>
                <Property>
                  <Name>TextField</Name>
                  <Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{78FF1668-CDDB-4645-8BED-FC2179944F5F}</Value>
                </Property>
              </ArrayOfProperty>
            </Customization>
       </Field>
       <Field ID="{78FF1668-CDDB-4645-8BED-FC2179944F5F}" Name="Field_TaxonomyDemoTaxHTField0" Type="Note" DisplayName="TaxonomyDemoTaxHTField0" StaticName="Field_TaxonomyDemoTaxHTField0" ShowInViewForms="FALSE" Required="FALSE" Hidden="TRUE" CanToggleHidden="TRUE"/>
       <Field ID="{971BA7B5-48EF-40D5-B863-59A93BF4EBF4}" Name="Category" DisplayName ="分类" Type="Lookup"  List="Lists/BusinessCategoryList" />
       <Field ID="{971BA7B5-48EF-40D5-B863-59A93BF4EBF5}" Name="Categorys" DisplayName ="多重分类" Type="LookupMulti"  List="Lists/BusinessCategoryList" Mult="TRUE" ShowField="Title"/>

    7.将<ContentType></ContentType>节点改为如下情形

          <ContentType ID="0x01002EF9586416114FC28896F05C3A2DA447" Name="测试列表" Group="列表" Description="列表" Version="0">
    
            <FieldRefs>
              <FieldRef ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E1}" Name="Title"/>
              <FieldRef ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E2}" Name="LinkTitleNoMenu" />
              <FieldRef ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E3}" Name="LinkTitle" />
              <FieldRef ID="{57C67E26-6122-40EC-945C-D0E14CCDC2E4}" Name="Test" />
            </FieldRefs>
          </ContentType>

    8.在 <View BaseViewID="1" .......

             <ViewFields ....节点下添加节点

              <FieldRef Name="Test"></FieldRef>

    9.<List></List>节点的Url属性改为Lists/SharepointTest

    10.好了,可以直接部署了,部署成功以后可以看到列表了。

  • 相关阅读:
    SQL*PLUS命令的使用大全
    Oracle总结
    SQL*PLUS命令的使用大全
    Java经典面试题
    学习Java的30个基本概念
    Java经典面试题
    学习Java的30个基本概念
    Oracle总结
    ORACLE大数据量下的分页解决方法
    XAMPP修改80和443端口及创建虚拟目录
  • 原文地址:https://www.cnblogs.com/Percy/p/4167684.html
Copyright © 2011-2022 走看看