SharePoint Add Datasheet View Programmatically
Hi,
Just a quick function to add Datasheet View when you're creating a document library or list programmatically:
HTH,
Andreas
Just a quick function to add Datasheet View when you're creating a document library or list programmatically:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | private void AddDataSheetView(SPList list) { string viewName = "Datasheet View" ; //check if the view exist already, if not create it SPView datasheetView = null ; try { datasheetView = list.Views[viewName]; } catch (System.ArgumentException e) { ;} if (datasheetView == null ) { list.Views.Add(viewName, list.DefaultView.ViewFields.ToStringCollection(), null , 100, true , false , SPViewCollection.SPViewType.Grid, false ); list.Views[viewName].Update(); } } |
HTH,
Andreas
Comments
Post a Comment