5

I’ll keep it short and sweet. Does anyone really know what the "ListTemplateOwner" tag of the elements.xml's "Receivers" node really means?

From Microsoft’s site: http://msdn.microsoft.com/en-us/library/ms431081(loband).aspx

ListTemplateOwner: Optional Text. Specifies the GUID of the list template owner if the list template is registered via Features, or the name of the site definition if the list template is registered by a site definition.

Danny
  • 437
  • 4
  • 11

3 Answers3

2

If the list is defined by a ListTemplate in a Feature then ListTemplateOwner is the ID of the feature that defined the list.

When you're refering to any of the standard lists (with ListTemplateId < 10000) then you don't need to specify a ListTemplateOwner (due to backwards compability)

When you're refering to a list that's defined by you or a third party, then you need the combination of ListTemplateId (> 10000 and matching the Type attribute from the defining ListTemplate) and ListTemplateOwner matching the FeatureId of the feature that defined the ListTemplate.

This is due to the fact that when you define a ListTemplate the rule is that Type should be > 10000 and unique inside the feature, but any number of feature may have their own ListTemplate with type 10001 (and feature which define lists usually just start from 10001)

If the list is defined by a ListTemplate in a Site definition then ListTemplateOwner is the name of that Site Definition, but don't define lists in Site definitions do it in features.

Per Jakobsen
  • 3,767
  • 17
  • 19
1

This is not correct, the feature ID when set to the current feature, which contains the list definition for the list type, does not target the reciever correctly...

<ListTemplate
    Name="SomeList"
    Type="99002"
    BaseType="0"
    OnQuickLaunch="TRUE"
    SecurityBits="11"
    Sequence="410"
    DisplayName="Some List"
    Description="Custom List used for whatnot"
    Image="/_layouts/images/itgen.gif"/>

<Receivers ListTemplateId="99002" ListTemplateOwner="B1E4631D-52A1-48d0-A319-2DDC2893AA57">

What you need to do is give each List Template a unique ID, regardless of the owning feature.

0

I am guessing that it refers to the ID (GUID) of the SharePoint object that owns the list template. Think of it like the ID column of a database and this would be it's foreign key.

theG
  • 585
  • 3
  • 9
  • Thanks for your response. Would you happen to know where I can find this GUID/ID? I don't think it's the Feature Id. – Danny Apr 24 '09 at 16:54
  • Actually, let me rephrase my comment. I not exactly sure what you mean “SharePoint object”. Can you elaborate on this and how do I get its GUID/ID? – Danny Apr 24 '09 at 17:01
  • SharePoint object is really anything managed in SharePoint whether it be a list, list item, site, site collection, etc.... The GUID is the ID of it in the content database. I don't fully understand what you mean by how you would get it. Do you need to know what it is? In feature installation, it would be set automagically. – theG Apr 24 '09 at 17:09
  • When you create a feature you have the opportunity to set it. ... Receivers> I’m having a hard time pinpointing what it actually does. I thought it was used to add some more context to what list type gets affected. My question here is purely academic but I have a deep desire to figure this out ;) – Danny Apr 24 '09 at 17:33
  • I wonder if it might be a way to tie a group of Receivers to a specific element. If you had more than one block, you could specify a specific object for each block. – theG Apr 24 '09 at 17:54
  • Sorry about this, could you elaborate a bit more on your comment "you could specify a specific object for each block". What do you mean by a specific object? – Danny Apr 24 '09 at 18:31
  • Sorry. You could specify a specific owner object for each block of receivers. So, a specific list could 'own' a block of receivers, etc. – theG Apr 24 '09 at 18:55
  • Are you thinking a list instance? If so, this would assume that the developer has knowledge of the instance that he is targeting. Would you surmise that this could be done using the block? – Danny Apr 24 '09 at 19:08
  • Good point. Obviously, a list instance would not be an ideal owner in this situation. But, I am thinking (and this is pure thought) that this field is there for those instances where you want to explicitly declare the owning object. I'm thinking it probably wasn't meant to be used declaritively, but is used by MOSS processes and in so is exposed. – theG Apr 24 '09 at 19:59
  • If you have some time, take a peek at this Blog posting about event receivers. In the past, he has done a fairly good job detailing some of the subtleties of the features.xml file. http://blogit.create.pt/blogs/andrevala/archive/2009/02/21/SharePoint-2007-Deployment_3A00_-Event-Registration-Features.aspx – Danny Apr 27 '09 at 17:23
  • As you can see, he makes the assumption that ListTemplateOwner property links up with the feature id. I could be projecting here but if that's what the intent is for that would make a lot of sense. The reason for this is that the List Templates type property must be unique for any one feature. For instance I can create a List Template with the a type of 101 () and it won't stomp on Microsoft's Document Library list template, however, if I registered my event receiver with the ListTemplateId set to 101, it would bind not only to any of my lists but to Microsoft's lists. – Danny Apr 27 '09 at 17:24
  • My thought is that the ListTemplateId property, in combination with the ListTemplateOwner property, gives a developer an opportunity to register his/her receiver in a more targeted way. Unfortunately, I've tried this scenario and it doesn't work. It always registers to all 101 lists. In the blog post you'll see that they are using the type of 3500. This would keep me free from binding to the Microsoft lists but what about another developer that randomly decides to give his/her list template a type value of 3500? – Danny Apr 27 '09 at 17:24
  • Sorry about all my rambling but one other thing ;). I did load up the Microsoft.SharePoint.dll in reflector and did a member and a string search for the value ListTemplateOwner and guess what, no hits. I am starting to wonder if this thing is even getting parsed. If you do a search for ListTemplateId you get a hit on the SPEventElement, as you would expect. Anyhow, I'll probably look into downloading any new Service Packs that I can and see if it changes the results. Thanks, – Danny Apr 27 '09 at 17:26
  • Just to clarify, this field doesn't have to do with the TypeId. It has to do with the instance Id of the owning object. The value will be a GUID, not an integer. Anyways, WSS and MOSS SP2 comes out today supposedly. Maybe there will be something new that will help out. – theG Apr 28 '09 at 15:19
  • Yea, the ListTemplateOwner is a GUID and the ListTemplateId is an integer. In everything I've seen, the ListTemplate has no ID and you references the ListTemplate by its type. In a way, i guess that's its id. A bit confusing but what can you do. Thanks, – Danny Apr 28 '09 at 17:25
  • Actually, no. The ListTemplateId is not a unique identifier as ListTemplateOwner is. ListTemplateOwner will have a value corresponding to a unique object (List) instance. – theG Apr 28 '09 at 17:37
  • Yea, i'm not saying that the ListTemplateId is a unique identifier for the receiver but it does relate to the ListTemplate type ID. From what i gather from the MS documentation, they say that that each type must be unique within a feature. Does this sound correct? – Danny Apr 29 '09 at 16:05
  • Yep, that is the way it works. I just wanted to make sure that it was understood that the ListTemplateOwner relates to a List instance, as opposed to a Template. – theG Apr 30 '09 at 14:33