locked
What is wrong with this list definition and content type that they cause Add Solution value is out of range exception? RRS feed

  • Question

  • <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <!-- Parent ContentType: Item (0x01) -->
      <Field ID="{5037E401-0F66-4A7E-8DCF-AFFB48B31B25}" Name="ActionId" PrimaryKey="True" Type="Guid" EnableLookup="True" />
      <Field Name="ActionName" Type="Text" ID="{909AA623-EF9A-465D-A100-ED5F31BD318C}" MaxLength="50"/>
      <Field Name="ActionDescription" Type="Text" ID="{EF68C1F2-49C6-4AF0-97E3-C026A616F7C5}" MaxLength="1000" />
      <ContentType ID="0X0100A6D47C1E3E03441DB1736E496808FC31"
                   Name="Action"
                   Group="Custom Content Types"
                   Description="My Content Type"
                   Inherits="TRUE"
                   Version="0">
        <FieldRefs>
          <FieldRef ID="{5037E401-0F66-4A7E-8DCF-AFFB48B31B25}"/>
          <FieldRef ID="{909AA623-EF9A-465D-A100-ED5F31BD318C}"/>
          <FieldRef ID="{EF68C1F2-49C6-4AF0-97E3-C026A616F7C5}"/>
        </FieldRefs>
      </ContentType>
    </Elements>

    And the list definition:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
        <ListTemplate
            Name="ActionList"
            Type="10000"
            BaseType="0"
            OnQuickLaunch="TRUE"
            SecurityBits="11"
            Sequence="410"
            DisplayName="ActionList"
            Description="My List Definition"
            Image="/_layouts/images/itgen.png"/>
    </Elements>

    And the scema for the list:

    <?xml version="1.0" encoding="utf-8"?>
    <List xmlns:ows="Microsoft SharePoint" Title="ActionList" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/ActionList" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
      <MetaData>
        <ContentTypes>
          <ContentType ID="0XA6D47C1E3E03441DB1736E496808FC31" Name="Action" Group="Custom Content types" Version="0" Description="Action Content Type">
            <FieldRefs>
              <FieldRef ID="{5037E401-0F66-4A7E-8DCF-AFFB48B31B25}" />
              <FieldRef ID="{909AA623-EF9A-465D-A100-ED5F31BD318C}" />
              <FieldRef ID="{EF68C1F2-49C6-4AF0-97E3-C026A616F7C5}" />
            </FieldRefs>
          </ContentType>
        </ContentTypes>
        <Fields>
          <Field ID="{5037e401-0f66-4a7e-8dcf-affb48b31b25}" Name="ActionId" PrimaryKey="True" Type="Guid" />
          <Field Name="ActionName" Type="Text" ID="{909aa623-ef9a-465d-a100-ed5f31bd318c}" MaxLength="50" />
          <Field Name="ActionDescription" Type="Text" ID="{ef68c1f2-49c6-4af0-97e3-c026a616f7c5}" MaxLength="1000" />
        </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>
            </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="pages\viewpage.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="Attachments">
              </FieldRef>
              <FieldRef Name="LinkTitle">
              </FieldRef>
            </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="pages\form.aspx" WebPartZoneID="Main" />
          <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
          <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
        </Forms>
      </MetaData>
    </List>

    Friday, January 4, 2013 4:12 PM

Answers

All replies

  • Hey,

    I think

    Field Name="ActionDescription" Type="Text" ID="{ef68c1f2-49c6-4af0-97e3-c026a616f7c5}" MaxLength="1000" />

    following line is causing that error.The maximum length you can provide to any "Text" field is "255" .

    And you are providing 1000 which is incorrect.

    If you want to keep limit as 1000 then please change the datatype to "Note" [Multi Line text box] and set NumLines property for ex : NumLines="6".

    Hope this helps.

    let me know if you have any queries :)


    "The Only Way To Get Smarter Is By Playing A Smarter Opponent"

    Sunday, January 6, 2013 7:47 AM
  • I did try changing the data type to Note unfortunately that did not fix the problem.
    Monday, January 7, 2013 2:57 PM
  • Hello,

    Have you tried to add your solution step by step? first the content type only, then add the list template, then the list instance.

    It will help to find where the problem occurs


    Best regards, Christopher.
    Blog | Mail
    Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.
    Why mark as answer?

    Monday, January 7, 2013 3:09 PM
    Answerer
  • It fails on Content type 
    Monday, January 7, 2013 3:43 PM
  • Ok,

    One thing, I think that you need to add the name parameter in your fieldref 

    replace

     <FieldRef ID="{5037E401-0F66-4A7E-8DCF-AFFB48B31B25}"/>
          <FieldRef ID="{909AA623-EF9A-465D-A100-ED5F31BD318C}"/>
          <FieldRef ID="{EF68C1F2-49C6-4AF0-97E3-C026A616F7C5}"/>

    by

          <FieldRef ID="{5037E401-0F66-4A7E-8DCF-AFFB48B31B25}" Name="ActionId"/>
          <FieldRef ID="{909AA623-EF9A-465D-A100-ED5F31BD318C}" Name="ActionName"/>
          <FieldRef ID="{EF68C1F2-49C6-4AF0-97E3-C026A616F7C5}" Name="ActionDescription"/>

    if it's still not working, try to remove your content type and deploy your solution empty (just a test to check if you don't have something in your solution that cause this behaviour) If the empty solution work , try to add your content type field by field... 


    Best regards, Christopher.
    Blog | Mail
    Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.
    Why mark as answer?

    Monday, January 7, 2013 3:52 PM
    Answerer
  • It works without the contenttype and fails with it even with adding the name field.

    Monday, January 7, 2013 3:56 PM
  • have you change the MaxLength="1000" ?

    is it working when your remove this one "  <Field ID="{5037E401-0F66-4A7E-8DCF-AFFB48B31B25}" Name="ActionId" PrimaryKey="True" Type="Guid" EnableLookup="True" />" ?


    Best regards, Christopher.
    Blog | Mail
    Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.
    Why mark as answer?

    Monday, January 7, 2013 3:58 PM
    Answerer
  • I got rid of maxlength still failed, I removed actionId and it still failed, and I tried changing the the tpe to note and it still failed.
    Monday, January 7, 2013 4:54 PM
  • Hi WSD,

    Have a look at your schema.xml file,

    <ContentTypes>
    <ContentType ID="0XA6D47C1E3E03441DB1736E496808FC31" Name="Action" Group="Custom Content types" Version="0" Description="Action Content Type">
    <FieldRefs>
    <FieldRef ID="{5037E401-0F66-4A7E-8DCF-AFFB48B31B25}" />
    <FieldRef ID="{909AA623-EF9A-465D-A100-ED5F31BD318C}" />
    <FieldRef ID="{EF68C1F2-49C6-4AF0-97E3-C026A616F7C5}" />
    </FieldRefs>

    </ContentType>
    </ContentTypes>

    I think you should use like the following,

    <ContentTypes>

          <ContentTypeRef ID= ="0X0100A6D47C1E3E03441DB1736E496808FC31"/>

    </ContentTypes>

    What’s more, it’s better to change the list template type above 10000.

    Please have look at the following articles, I have a test on my local server, it works well.

    http://msdn.microsoft.com/en-us/library/gg276355(v=office.14).aspx

    http://ranaictiu-technicalblog.blogspot.com/2011/04/sharepoint-2010-create-site-definition.html

    Best Regards.


    Kelly Chen
    TechNet Community Support

    Tuesday, January 8, 2013 3:04 AM
  • I want to create it from a ContentType Not a brand new definition requiring complete revision.

    I choose List Defintiion From content Type. That should work without me changing everything.

    I read the articles and tried that way but the reason I chose from ContentTypes was because that way fails.

    Tuesday, January 8, 2013 2:20 PM
  • Hi WSD,

    I have a test on your content type created code, this issue is caused by the content type id, it is incorrect. When I change the ID, it works well. Please have a check.

    For more information about content type id,

    http://msdn.microsoft.com/en-us/library/aa543822.aspx

    Best Regards.


    Kelly Chen
    TechNet Community Support


    Wednesday, January 9, 2013 3:06 AM
  • Try this link

    http://www.sharepointnutsandbolts.com/2007/04/deploying-content-types-as-feature.html

    Wednesday, January 9, 2013 4:39 AM