Создать определение списка под сайте сайта в определении сайта

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/70195

Вопрос

Я хочу создать определение списка и экземпляр списка при определенном Sub -Site. Это не может быть видно под сбором сайта.

Это было полезно?

Решение 2

Accomplished with the following code in Feature Activated event receiver.

SPSite site = null;
SPWeb web = null;
site = properties.Feature.Parent as SPSite;
web = site.AllWebs["SubSite"];
SPListTemplate temp = web.ListTemplates["ListDefinition"];
Guid newg = web.Lists.Add("ListInstance", "Description", temp);
SPList newlist = web.Lists[newg];
newlist.OnQuickLaunch = true;
newlist.Update();  

Другие советы

Create your List Definition using a Web Scoped feature. Set the feature attributes to Hidden=True.

You can then activate your feature manually using PowerShell for that sub-site.

For further automation you can either staple your feature to specific templates (so it is automatically included in sites which uses a specific template) or reference it in the WebFeatures element in the Onet.xml of your custom site definition.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top