0

Reading over this link: http://blogs.msdn.com/b/jackiebo/archive/2007/02/23/lookup-count-related-the-magic-behind-sharepoint-s-comments-column.aspx

I've decided I want to add this to a feature package I'm building. The feature is only deploying site columns and content types. My question is what should the XML look like to accomplish defining this field definition within my feature package?

Here's another link that describes this functionality. It also provides an example console app that will retrieve this information.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldlookup.countrelated.aspx

1

Tried Aggregation="Count" or ShowField="Counter" ?

1
<Field Name="NumComments" ReadOnly="TRUE" Type="Lookup" DisplayName="Comments" CountRelated="TRUE" List="List/ListName" ShowField="PostTitle" ID="{guid goes here}" StaticName="NumComments"/>

This is what I have found that works.

0

Unfortunately I can't open that link from here as the page never opens, but you could at least start with this XML:

<Field ID="{725F9AC7-6B1D-4fd5-A810-4D2673D4A5F6}" Name="UsageType" Type="Lookup" List="Lists/UsageTypes" Required="TRUE" ShowField="Title" StaticName="UsageType" DisplayName="Usage Type" />

This is an example of a lookup I use in one of my solutions. Change the ID and names accordingly!

  • Thanks! This is only half of what I'm looking for though. I know how to create a Lookup definition and your example is great for that. This field I'm trying to create is a special field though. It's only available in the GUI when you create a lookup from the Parent list and lookup back into the Child list. It provides a count of all your Child items. I'm just not sure how to define that definition in XML. – iOnline247 Mar 31 '11 at 16:49
  • I see, when I get home I hope to be able to see the link in your question. It doesn't open here at work! – spevilgenius Mar 31 '11 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.