Skip to main content

Cloud

Musings on custom site definitions

=

I am currently working on a custom site definition for some internal systems here at PointBridge and I wanted to share with you some of the "gotchas" and other observations that I am learned during this process that will hopefully help others avoid some of the pitfalls that I have encountered. These may not be earth shaking findings but more of a way for me to document in public view some of the things that I have found. This will prevent me from hitting the same roadblocks.

Populating URL fields (specifically those in a links list) in onet.xml

I found a great blog posting from Mark Arend on how SharePoint delimits multi-value fields. I tried to use this info to pre-populate a links list for the site definition I was using but couldn’t get the links to show up. I would get a line for the link but the description wouldn’t be shown.

Here was the code that was populating that list from onet.xml:

<List FeatureId="00BFEA71-2062-426C-90BF-714C59600103" Type="103" Title="$Resources:core,linksList;" Url="$Resources:core,lists_Folder;/$Resources:core,links_Folder;">

<Data>

<Rows>

<Row>

<!– These URL fields are in the resource file seprated by a comma between the URL part and the description.–>

<Field Name="URL">$Resources:Pointbridge.PbxCustomerSite,link1;</Field>

</Row>

<Row>

<Field Name="URL">$Resources:Pointbridge.PbxCustomerSite,link2;</Field>

</Row>

<Row>

<Field Name="URL">$Resources:Pointbridge.PbxCustomerSite,link3;</Field>

</Row>

</Rows>

</Data>

</List>

You will see that I am using a resource file to populate my data. For more information on how to do this, check out this great blog by Ken Schaefer.

The string in the resource file looked like this:

http://www.pointbridge.com,PointBridge Home Page

Notice the comma (",") that is used to delimit the field value. According to Mark’s posting, this should have worked but it didn’t. After some tinkering and a closer look at the example that Mark uses in his blog, I figured out that you need to have a space after the comma. Without the space after the comma, the line gets created but you don’t get it to look properly. After adding the space after the comma, everything works as planned. So for my example from above, the string should be:

http://www.pointbridge.com, PointBridge Home Page

Not showing a list on the Quick Launch bar in onet.xml

In order to not show a list on the Quick Launch bar, you just omit the QuickLaunchUrl attribute on the list declaration in onet.xml.

This snippet will show the list on the Quick Launch bar:

<List FeatureId="00BFEA71-E717-4E80-AA17-D0C71B360101"

Type="101"

Title="$Resources:core,shareddocuments_Title;"

Url="$Resources:core,shareddocuments_Folder;"

QuickLaunchUrl="$Resources:core,shareddocuments_Folder;/Forms/AllItems.aspx" />

This snippet will not show the list on the Quick Launch bar:

<List FeatureId="00BFEA71-E717-4E80-AA17-D0C71B360101"

Type="101"

Title="$Resources:core,shareddocuments_Title;"

Url="$Resources:core,shareddocuments_Folder;" />

Multiple Select Lookup Fields in schema.xml

So I was trying to create a lookup field in a custom list definition (schema.xml file) and was using the MSDN site for some help on the attributes of the Field element. In there I found that you could set the Type attribute to "LookupMulti" and that should get you a multiple select lookup field. Wrong! If you look down towards the bottom of the page for the Field element, you see a little note that tells you that you need to set the Mult attribute equal to "TRUE" to get this to work but unfortunately the poster says that you also set the Type to "Lookup". If you set the Type equal to "Lookup" and the Mult equal to "TRUE" you will get the following error:

To fix this problem, properly set the Type attribute to "LookupMulti" and the Mult attribute to "True" you will get what you are looking for, a multiple select lookup field. Here is the code:

<Field

Name="relatedIssues"

StaticName="relatedIssues"

Type="LookupMulti"

Mult="TRUE"

DisplayName="Related Issues"

List="$Resources:core,lists_Folder;/$Resources:Pointbridge.PbxCustomerSite,defectsList_Folder;"

ShowField="Title"

SourceID="http://schemas.microsoft.com/sharepoint/v3" />

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

PointBridge Blogs

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram