views:

576

answers:

2
+3  Q: 

ListTemplateOwner

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.

A: 

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
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
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
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
When you create a feature you have the opportunity to set it.<Elements ...> <ListTemplate Type=”100” .../> <Receivers ListTemplateId="100" ListTemplateOwner="?????"> ... </ Receivers></Elements>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
I wonder if it might be a way to tie a group of Receivers to a specific element. If you had more than one <Receivers> block, you could specify a specific object for each block.
theG
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
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
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 <ListInstance> block?
Danny
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
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
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 (<ListTemplate type=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
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
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
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
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
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
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
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
A: 

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