SharePoint 2010,SandBox Solution,uploaded .STP files to _catalogs/lt using Feature not coming in GetCustomListTemplates

前端 未结 2 1855
耶瑟儿~
耶瑟儿~ 2021-01-26 12:51

I have sandbox solution which has 2 features (both are sitecollection level features) I am activating both feature using same USER.

feature 1 : that upl

相关标签:
2条回答
  • 2021-01-26 13:29

    If you use the Record Center as the template for your root website in SharePoint 2010, GetCustomListTemplates() will always return 0 (zero).

    There is some weird bug that makes this happen.

    Here is code that you can try running in the SharePoint PowerShell. The return value for GetCustomListTemplates($web).Count will be zero if you have the root web made from the Record Center template.

    $site = get-spsite("http://localhost")
    $web = $site.RootWeb
    $list = $web.Lists["TestDocLibrary"]
    $list.SaveAsTemplate("MyListTemplate.stp", "MyListTemplate", "My List Template", $false)
    $site.GetCustomListTemplates($web).Count
    

    More information can be found at the following web pages:

    • http://social.msdn.microsoft.com/Forums/ar/sharepoint2010general/thread/c5455a27-360a-465c-91d5-f81beeac6789
    • http://sharepointrecordsmanagement.com/2011/02/

    Good luck! - Jason

    0 讨论(0)
  • 2021-01-26 13:37

    Does your list template derive from one of the default list templates like "Discussion Board"? I noticed that when I tried to do the following I encountered the same problem as you:

    1. Save a SharePoint 2007 "Discussion Board" list as a list template
    2. Use the method in this blog to convert the template to SharePoint 2010
    3. Upload the template to my SharePoint 2010 site

    I noticed that the default "Discussion Board" list template was not even an option for creating a new list in SharePoint 2010. Therefore I went to the site features and and turned on the "Team Collaboration Lists" just to enable the default "Discussion Board" list template. After doing that both the default "Discussion Board" list template and my custom "Bulletin Board" template showed up when I went to create a new list. Then I went to my powershell script and noticed that GetCustomListTemplates returned my custom template. I'm assuming that means the C# should work as well.

    Here is the list from the old SharePoint 2007 website:

    SharePoint 2007 list

    Here is the collaboration feature that enables the "Discussion Board" list template in the new SharePoint 2010 website:

    Team Collaboration Lists

    Here is the menu for creating a new list in the new SharePoint 2010 website AFTER enabling the team collaboration lists feature:

    New list form

    As you can see the "BulletinBoard" image is the same as the "Discussion Board" image so SharePoint probably couldn't use the "BulletinBoard" template because the "Discussion Board" template was not yet installed.

    0 讨论(0)
提交回复
热议问题