20 July 2011

CAML Case Sensitive Boolean Attributes in SharePoint

ATTENTION: The following description does not apply to CAML Querys in SPQuery object! In an SPQuery you have to write boolean values LOWERCASE ('true' or 'false')!

The value of the boolean properties in SharePoint XML-Files have to be set in UPPERCASE letters. In the example you see below the field "TestSiteColumn" is NOT required!
<?xml version="1.0" encoding="utf-8"?><Elements xmlns="http://schemas.microsoft.com/sharepoint/">  <Field    ID="{4B1F9ED3-5108-49FF-9320-F06F72245729}"    Type="Text"    DisplayName="TestSiteColumn"    StaticName="TestSiteColumn"    Name="TestSiteColumn"    Required="FALSE"    Group="TestGroup" />  <!-- Parent ContentType: Item (0x01) -->  <ContentType ID="0x01008c69bbf5ef1d4c10a48aac0e74e7be6b"    Name="DemoContentType"    Group="Custom Content Types"    Description="My Content Type"    Inherits="TRUE"    Version="0">    <FieldRefs>      <FieldRef ID="{4B1F9ED3-5108-49FF-9320-F06F72245729}"         Name="TestSiteColumn"         Required="true" />    </FieldRefs>  </ContentType></Elements>

To set the field "TestSiteColumn" to required you have to write the FieldRef as shown in following example.
<FieldRefs>  <FieldRef ID="{4B1F9ED3-5108-49FF-9320-F06F72245729}"     Name="TestSiteColumn"     Required="TRUE" /></FieldRefs>

Dirty Visual Studio gives the following Intellisense Options: If you choose one of the small Options this will not work. In the MSDN Documentation all Atrributes are written in Uppercase. But if Intellisense gives you such options you may want to choose them...

0 comments:

Post a Comment