Как сохранить сайт SharePoint как шаблон

by DenizK 13. декабря 2010 11:25

Иногда гораздо быстрее создать какое то решение через интерфейс SharePoint или SharePoint Designer и потом уже доработать его в Visual Studio. Краткое описание последовательности действий по созданию WSP шаблона и редактировании его в Visual Studio привожу ниже (оринигал статьи находится по ссылке http://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=117)

Consider the list shown below. It's based on the Links list and is bound to a content type named Fun Link. Note that this could just as easily be based on the Custom List template.

The site content type, Fun Link, contains a custom site column, Classification, that provides a set of choices.

Getting this into Visual Studio is easy. Open up the Site Settings page and click the Save site as template link.

Give your template a name. It doesn't matter what name you choose because the template is just an intermediate step that you'll throw away when you are done. If you choose Include Content, your new feature will recreate the list data.

When the operation completes, follow the links the your site's Solution Gallery and save the resulting WSP to your local machine.

Next, open Visual Studio and create a new project. Select the Import SharePoint Solution Package template.

Next choose either Farm or Sandbox deployment. In this example, either works fine.

The SharePoint Customization Wizard displays. You don't want everything in the wsp, just the items you need to recreate the custom list. Press CTRL+A to select all the items and then SPACE to deselect everything. Now you are ready to select only the items you need. In this case you need the Fun Link content type.

The Classification field…

The Fun Links list instance…

And the ListsFun Links_pages module.

 

Once you have the set of items you need selected, click Finish. Visual Studio will display the warning shown below telling you about all sorts of dependencies. You don't need any of them because they are all fields from the core fields feature and are always available on every site. Click No and your done!

Here is a screen shot of the new solution in Solution Explorer.

 

Оценок нет

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

SharePoint | Tips & tricks | Visual Studio

Комментарии закрыты

О нас

Это блог компании Инлайн. Мы занимаемся разработкой сайтов, корпоративных порталов и корпоративных информационных систем на основе новейших технологии Microsoft  - ASP.NET, SharePoint и Silverlight. А в этом блоге мы размещаем самые последние новости в области разработке для web.

Облако тегов