none
Problems with discussion after generating site definition.

    Pertanyaan

  • Hi all

    I use "SharePoint Solution Generator 2008" to generate site definitions. I use this way
    On the generated default page, I have a lot of custom lists. All of them work except discussion board.

    I can add new posts, and it will get added in the view. When I click on the post that is added, I don't get to see the post. Instead the view disappears, and says that there are no elements to show in the view. When I go deeper in the settings to see the list itself, I can see the post added. When I click on a post, then I will get to see the content. When I return to the default page of the site I created, I can see the posts in the view, but if I click on a post, I still get the same error saying that items don't exist.

    I use MOSS with sp1, and norwegian language pack. 

    Any experience with this kind of problem?
    Any suggestions?


    Regards

    09 Desember 2009 12:50

Semua Balasan

  • Hi,

    did you find any solution i would really appreciate it.

     

    thanks


    Regards, Khalil A. Kamel
    14 Desember 2011 19:35
  • I was not able to fix this issue. However I used a web created event receiver and changed the chrome type by code.

    This is the only solution i found.


    Regards, Khalil A. Kamel

    10 Juli 2012 8:18
  • Hi

    I think this is a SharePoint bug. Please see - http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/e5f4efae-887b-40af-82c2-10f3be56bd73

    I also faced the same issue. Then in order to solve this, I had to programmatically add view in the page. Below is the code that I used - 

    private void SetViewsInPages(SPWeb objWeb, string listName, string page, string viewName, string newWPTitle, string wpZone, int wpOrder, "idAddNewDiscuss", "Add New Discussion")
            {
                try
                {
                    SPList oList = objWeb.Lists[listName];
                    if (oList != null)
                    {
                        objWeb.AllowUnsafeUpdates = true;
     
                        SPLimitedWebPartManager wpMgr = null;
                        ListViewWebPart lvCalendar = null;
     
                        SPFile objFile = objWeb.GetFile(page);
     
                        if (objFile.CheckOutStatus == SPFile.SPCheckOutStatus.None)
                        {
                            objFile.CheckOut();
                        }
     
                        using (wpMgr = objFile.GetLimitedWebPartManager(PersonalizationScope.Shared))
                        {
                            try
                            {
                                wpMgr.Web.AllowUnsafeUpdates = true;
                                lvCalendar = new ListViewWebPart();
                                lvCalendar.Title = newWPTitle;
                                lvCalendar.ListName = oList.ID.ToString("B").ToUpper();
     
                                SPView subView = oList.Views[viewName];
                                lvCalendar.ViewGuid = subView.ID.ToString("B").ToUpper();
     
                                wpMgr.AddWebPart(lvCalendar, wpZone, wpOrder);
     
                                foreach (System.Web.UI.WebControls.WebParts.WebPart webPart in wpMgr.WebParts)
                                {
                                    if (webPart is ListViewWebPart)
                                    {
                                        if (webPart.Title == newWPTitle)
                                        {
                                            lvCalendar = (ListViewWebPart)webPart;
     
                                            if (lvCalendar != null)
                                            {
                                                // Get the view used in the web part by using reflection
                                                PropertyInfo ViewProp = lvCalendar.GetType().GetProperty("View", BindingFlags.NonPublic | BindingFlags.Instance);
                                                SPView spView = ViewProp.GetValue(lvCalendar, null) as SPView;
     
                                                string txt = spView.SchemaXml;
                                                spView.GetType().InvokeMember("EnsureFullBlownXmlDocument", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, spView, null, System.Globalization.CultureInfo.CurrentCulture);
     
                                                PropertyInfo NodeProp = spView.GetType().GetProperty("Node", BindingFlags.NonPublic | BindingFlags.Instance);
                                                XmlNode newNode = NodeProp.GetValue(spView, null) as XmlNode;
                                                XmlNode toolbarNode = newNode.SelectSingleNode("Toolbar");
                                                if (toolbarNode != null)
                                                {
                                                    toolbarNode.Attributes["Type"].Value = "Freeform";
                                                }
     
                                                XmlAttribute positionNode = toolbarNode.OwnerDocument.CreateAttribute("Position");
                                                positionNode.Value = "After";
                                                toolbarNode.Attributes.Append(positionNode);
                                                toolbarNode.InnerXml = string.Format(@"<IfHasRights><RightsChoices><RightsGroup PermAddListItems=""required""/></RightsChoices><Then><HTML><![CDATA[ <table width=100% cellpadding=0 cellspacing=0 border=0 ><tr> <td colspan=""2"" class=""ms-partline""><IMG SRC=""/_layouts/images/blank.gif"" width=1 height=1 alt=""""></td> </tr><tr> <td class=""ms-addnew"" style=""padding-bottom: 3px""> <img src=""/_layouts/images/rect.gif"" alt="""">&nbsp;<a class=""ms-addnew"" ID=""{0}"" href=""]]></HTML><URL Cmd=""New""/><HTML><![CDATA["" ONCLICK=""javascript:NewItem(']]></HTML><URL Cmd=""New""/><HTML><![CDATA[', true);javascript:return false;"" target=""_self"">]]></HTML><HTML>{1}</HTML><HTML><![CDATA[</a> </td> </tr> <tr><td><IMG SRC=""/_layouts/images/blank.gif"" width=1 height=5 alt=""""></td></tr> </table>]]></HTML></Then></IfHasRights>", newItemID, newItemText);
     
                                                spView.Update();
                                                wpMgr.SaveChanges(lvCalendar);
                                            }
                                        }
                                    }
                                }
     
                                wpMgr.Web.AllowUnsafeUpdates = false;
                            }
                            catch (Exception ex)
                            {
                                Logger.Write("Exception occured while updating '" + viewName + "' view in page - '" + page + "' in site - " + objWeb.Url + Environment.NewLine + "Exception Details : " + ex.Message + Environment.NewLine + "Stack Trace : " + ex.StackTrace + Environment.NewLine + "Inner Exception : " + ex.InnerException);
                            }
                        }
     
                        objFile.CheckIn("OK");
                        objWeb.AllowUnsafeUpdates = false;
                    }
                }
                catch (Exception ex)
                {
                    Logger.Write("Exception occured while modifying Calendar view in site - " + objWeb.Url + Environment.NewLine + "Exception Details : " + ex.Message + Environment.NewLine + "Stack Trace : " + ex.StackTrace + Environment.NewLine + "Inner Exception : " + ex.InnerException);
                }
            }
     
        }
    }


    Prateesh Nair (MCTS) | Orion India Systems


    10 Juli 2012 17:00