I created Sharepoint List programmatically in FeatureActivated EventReceiver. When i try to open "Content Management"(_layouts/sitemanager.aspx) page I get error.
There is log:
08/16/2012 11:44:12.90 w3wp.exe (0x1634) 0x1B64 SharePoint Foundation General 72k9 High **Failed to retrieve the list schema for feature {E8CD91FD-4D38-4144-B123-215C44305819}, list template 10000; expected to find it at: "". 8333bbb5-afff-45b6-8d4c-112421a1f5f9**
08/16/2012 11:44:12.90 w3wp.exe (0x1634) 0x1B64 SharePoint Foundation General 8kh7 High Недопустимое имя файла. Нельзя использовать указанное имя файла. Это имя существующего файла или папки, либо у вас отсутствует разрешение на доступ к этому файлу.<nativehr>0x81020030</nativehr><nativestack></nativestack> 8333bbb5-afff-45b6-8d4c-112421a1f5f9
08/16/2012 11:44:12.90 w3wp.exe (0x1634) 0x1B64 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (Load CachedList:d3fc78de-d173-4499-9bcd-b036ce72a2c0). Время выполнения=68,427258275504 8333bbb5-afff-45b6-8d4c-112421a1f5f9
08/16/2012 11:44:12.91 w3wp.exe (0x1634) 0x1B64 SharePoint Foundation Runtime tkau Unexpected System.NullReferenceException: В экземпляре объекта не задана ссылка на объект. в Microsoft.SharePoint.Publishing.Internal.WebControls.ObjectSerializer.DeleteAllowed(Boolean checkPermissions) в Microsoft.SharePoint.Publishing.Internal.WebControls.SmtButtonField.FormatDataValue(Object dataTextValue, Boolean encode) в System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e) в Microsoft.SharePoint.Publishing.Internal.WebControls.SmtButtonField.OnDataBindField(Object sender, EventArgs e) в System.Web.UI.Control.OnDataBinding(EventArgs e) в System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) в System.Web.UI.Control.DataBindChildren() в System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) в System.Web.UI.WebControls.GridView... 8333bbb5-afff-45b6-8d4c-112421a1f5f9
08/16/2012 11:44:12.91* w3wp.exe (0x1634) 0x1B64 SharePoint Foundation Runtime tkau Unexpected ....CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) в System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) в Microsoft.SharePoint.WebControls.SPGridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) в System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) в System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) в System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) в System.Web.UI.WebControls.DataBoundControl.PerformSelect() в System.We... 8333bbb5-afff-45b6-8d4c-112421a1f5f9
08/16/2012 11:44:12.91* w3wp.exe (0x1634) 0x1B64 SharePoint Foundation Runtime tkau Unexpected ...b.UI.WebControls.BaseDataBoundControl.EnsureDataBound() в System.Web.UI.WebControls.GridView.OnPreRender(EventArgs e) в System.Web.UI.Control.PreRenderRecursiveInternal() в System.Web.UI.Control.PreRenderRecursiveInternal() в System.Web.UI.Control.PreRenderRecursiveInternal() в System.Web.UI.Control.PreRenderRecursiveInternal() в System.Web.UI.Control.PreRenderRecursiveInternal() в System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 8333bbb5-afff-45b6-8d4c-112421a1f5f9
08/16/2012 11:44:12.91 w3wp.exe (0x1634) 0x1B64 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:http://192.168.0.37:90/ru/_layouts/sitemanager.aspx?Source=%2Fru%2FPages%2Fdefault%2Easpx)). Время выполнения=260,969845664709 8333bbb5-afff-45b6-8d4c-112421a1f5f9
My code:
SPList list = null;
using (var currentSite = new SPSite(/*"http://sp01.edu.gov.kz/"*/"http://win-276tp9k5um4:90/"))
{
using (var currentWeb = currentSite.AllWebs["collaboration"])
{
string listUrl = "/collaboration/Lists/Questions";
list = null;
try
{
list = currentWeb.GetList(listUrl);
currentWeb.Lists.Delete(list.ID);
}
catch (FileNotFoundException ex)
{
}
Guid listId = currentWeb.Lists.Add("Questions", "Using by Questions&Answers Module.", SPListTemplateType.GenericList);
list = currentWeb.Lists[listId];
if (!list.HasUniqueRoleAssignments)
{
list.BreakRoleInheritance(true);
}
list.WriteSecurity = 1;
list.AnonymousPermMask64 =
(SPBasePermissions.Open |
SPBasePermissions.OpenItems |
SPBasePermissions.ViewFormPages |
SPBasePermissions.ViewListItems |
SPBasePermissions.EditListItems |
SPBasePermissions.AddListItems);
list.Update();
if (!list.Fields.ContainsField("Name"))
list.Fields.Add("Name", SPFieldType.Text, true);
if (!list.Fields.ContainsField("Email"))
list.Fields.Add("Email", SPFieldType.Text, false);
if (!list.Fields.ContainsField("Question"))
list.Fields.Add("Question", SPFieldType.Note, true);
if (!list.Fields.ContainsField("Answer"))
list.Fields.Add("Answer", SPFieldType.Note, true);
list.Update();
}
}
In the first line of the log writed that Sharepoint can't retrieve the list schema.
Any ideas?
I've got a solution! I activated some List Definitions in Features and it worked.