在Sharepoint中复制Settle.html,粘贴后改名为km.html,修改km.html会自动更新km.master,修改好模板后需要在站点发布。
添加List
添加WebPart,继承KmWebParts
添加css,修改WebPart界面
测试
添加Features
添加Entities.cs,新建类
绑定数据
注意namespace中是否有重名全局变量
List设置Content Types为ListFieldsContentType
ListInstance设置deployment 为none,不覆盖原数据
修改两个List Type,唯一且最好大于10000
SharePoint获取子站点数据:
protected void Page_Load(object sender, EventArgs e) { try { SPWeb web = SPControl.GetContextWeb(Context); SPWeb wb = new SPSite(web.Site.ID).OpenWeb(); SPWebCollection subWebCol = wb.Webs; var list = new List<SubSiteInfo>(); for (int i = 0; i < subWebCol.Count; i++) { list.Add(new SubSiteInfo { SubSiteUrl = subWebCol[i].Url, SubSiteName = subWebCol[i].Name }); } var subSite = new SPSite(web.Site.ID).AllWebs; foreach (SPWeb site in subSite) { if(site.IsRootWeb) continue; var content = site.Lists["ProjectContent"]; foreach (SPListItem item in content.Items) { var link = new SubSiteInfo { SubSiteName = item["ProjectName"].ToString() }; lblErrorMessage.Text += link.SubSiteName; } } } catch (Exception ex) { LogHelper.ShowError(lblErrorMessage, ex); } }