Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

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

share|improve this answer
    
I'll give that whirl and post back. Do you have a link to MSDN about these attributes? Really appreciate it James! –  iOnline247 Apr 1 '11 at 15:51
    
no worries :) msdn.microsoft.com/en-us/library/ms437580.aspx –  James Love Apr 1 '11 at 16:36
<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.

share|improve this answer

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!

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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