Создать определение списка под сайте сайта в определении сайта
-
10-12-2019 - |
Вопрос
Я хочу создать определение списка и экземпляр списка при определенном 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.
Не связан с sharepoint.stackexchange