locked
Find Announcement List Template RRS feed

  • Question

  • Hi,

    I created a list template based off the announcement list. I added some columns to it and saved it as a template. Is there a way (programmatically) to check to see if a list was based on my specific template? I see my list still uses the announcement featureID and ID but I only want to find lists created with my specific template.

    Thanks for any help.

    Wednesday, September 8, 2010 9:24 PM

Answers

All replies

  • Here should use content type instead of list template.

    Creating a list from a list template is just like "copy and paste", there is no relationship between the original object and the new object.

    Thursday, September 9, 2010 1:48 AM
  • Yes, agree with Eric, as far I know there is no way to connect list with list template. I can suggest to check your custom column(s) existence in the list.Fields to verify list type.
    Maxim Shulga (http://maxshulga.blogspot.com/)
    Thursday, September 9, 2010 7:14 AM
  • The only way to find lists of a specific type is to create a list definition http://msdn.microsoft.com/en-us/library/ms466023%28v=office.12%29.aspx .  When you create a list definition you specify a type id for the list and the feature which makes the list available can be seen on instances of the SPList programmatically.

    Using content types associated to a list you could check the SPList.ContentTypes property to see if your content type is associated to the list.


    My SharePoint Blog - http://www.davehunter.co.uk/blog
    • Proposed as answer by Eric Fang Thursday, September 9, 2010 1:51 PM
    • Marked as answer by ChrisC_26 Thursday, September 9, 2010 3:30 PM
    Thursday, September 9, 2010 8:27 AM
  • Cool, thanks all I'll look into it. Sounds like that will work for me! Gotta love these forums!
    Thursday, September 9, 2010 3:29 PM
  • Another choice is to create a content type first, then add it to a list as the only content type, then save this list as a list template.

    Then we can use the new list template to create lists.

    This solution is easier to maintain.

    Friday, September 10, 2010 4:14 AM