0

In my project I am using SharePoint Online and Provider hosted app for provisioning new sites. I was able to successfully provision a new task list in the newly provisioned site and a custom Gannt chart view associated with it.

But the newly created Gantt chart view is not getting listed in the standard view menu list. I can see the view if I access the list of views from the ribbon. Is this is a SharePoint related bug?

Sooraj
  • 41
  • 7

1 Answers1

0

I found solution:

You need modify XsltListViewWebPart tool bar option from one value to another, and then back. That solves that bug in SharePoint.

public static void FixGanttIssue(SPList list, string ViewName)
    {
        SPSite site = list.ParentWeb.Site;
        SPLimitedWebPartManager AllItemsMan = site.RootWeb.GetFile(list.Views[ViewName].Url).GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
        XsltListViewWebPart wp = (XsltListViewWebPart)AllItemsMan.WebParts[0];
        wp.Toolbar = "Summary Toolbar";
        AllItemsMan.SaveChanges(wp);
        wp.Toolbar = "Full Toolbar";
        AllItemsMan.SaveChanges(wp);
    }
Sergiy Kostenko
  • 273
  • 1
  • 2
  • 11