项目摘要Web部件在sharepoint中进行配置

时间:2016-08-16 09:08:24

标签: c# sharepoint sharepoint-2013 web-parts

我正在开发维基页面中的“项目摘要Web部件”供应以及发布页面。

以下是我的代码:

  ProjectSummaryWebPart newprojectSummaryWebPart = (ProjectSummaryWebPart)newWebPart;
                        Microsoft.SharePoint.Portal.WebControls.ProjectSummaryWebPart projectSummaryWebPart = new Microsoft.SharePoint.Portal.WebControls.ProjectSummaryWebPart();

                        projectSummaryWebPart.ID = webpartId;
                        projectSummaryWebPart.Title = newprojectSummaryWebPart.Title;
                        projectSummaryWebPart.AllowMinimize = newprojectSummaryWebPart.AllowMinimize;
                        projectSummaryWebPart.AllowZoneChange = newprojectSummaryWebPart.AllowZoneChange;
                        projectSummaryWebPart.AllowHide = newprojectSummaryWebPart.AllowHide;
                        projectSummaryWebPart.AllowClose = newprojectSummaryWebPart.AllowClose;
                        projectSummaryWebPart.ListId = newprojectSummaryWebPart.listID;



                        #region Set Panels In Project Summary Webpart
                        ProjectSummaryPanelConfig panelConfig = new ProjectSummaryPanelConfig();
                        panelConfig.IsLatePanel = newprojectSummaryWebPart.IsLatePanel;
                        if (newprojectSummaryWebPart.DaysToSearch > 0)
                        {
                            //Set DaystoSearch value to display tasks as per the latest due date.
                            //If due date is after 3 days and set value is 3 than only those task displayed in web part which has a due date after 3 days.
                            panelConfig.Enabled = true;
                            panelConfig.DaysToSearch = newprojectSummaryWebPart.DaysToSearch;


                        }
                        projectSummaryWebPart.Panels.Add(panelConfig);

我想在网页部件中设置面板值。如果我正在配置没有面板值的Web部件,那么它的工作性能非常出色。但是当我设置面板值使用“ProjectSummaryPanelConfig对象”代码时给出了以下错误:

  

错误:System.NullReferenceException:对象引用未设置为   对象的实例。

你可以尽快帮助我吗?

0 个答案:

没有答案