List View WebPart Toolbar Type

%3CLINGO-SUB%20id%3D%22lingo-sub-13516%22%20slang%3D%22en-US%22%3EList%20View%20WebPart%20Toolbar%20Type%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-13516%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20a%20way%20to%20change%20toolbar%20type%20on%20ListView%20WebPart%20via%20CSOM%3F%3C%2FP%3E%3CP%3EIt%20doesn't%20seem%20to%20work%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-69408%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20List%20View%20WebPart%20Toolbar%20Type%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-69408%22%20slang%3D%22en-US%22%3EHi%20Alen%2C%3CBR%20%2F%3E%3CBR%20%2F%3EAre%20you%20able%20to%20share%20some%20more%20details%20about%20what%20you%20needed%20to%20overload%20to%20resolve%20the%20issue%3F%3CBR%20%2F%3E%3CBR%20%2F%3E-Troy%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-14216%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20List%20View%20WebPart%20Toolbar%20Type%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-14216%22%20slang%3D%22en-US%22%3E%3CP%3ECool%20so%20my%20post%20helped%20you%20a%20bit%20in%20the%20right%20direction%20%3B)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-14021%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20List%20View%20WebPart%20Toolbar%20Type%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-14021%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Paul%2C%3C%2FP%3E%3CP%3EIt%20works%20now.%20I%20managed%20to%20change%20toolbar%20type.%3C%2FP%3E%3CP%3EActually%20it%20was%20the%20problem%20in%26nbsp%3B%20XsltWebPartPostProcessor%20Process%20method.%3C%2FP%3E%3CP%3EIt%20invokes%26nbsp%3BUpdateHiddenView(xsltHiddenView%2C%20listView.ListViewXml)%3B%3C%2FP%3E%3CP%3EI%20have%20added%20overload%20with%20changed%20listviewSchemaXml%20as%20parameter%2C%20and%20update%20now%20works%20like%20a%20charm.%3C%2FP%3E%3CP%3EThanks%20for%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlen%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-14008%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20List%20View%20WebPart%20Toolbar%20Type%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-14008%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Alen%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethat%20is%20strange%20you%20can%20not%20update%20the%20xml%20def%20but%20the%20view%20should%20be%20possible%20did%20it%20in%20my%20code%20as%20well.%3C%2FP%3E%3CP%3EMaybe%20it%20changed%20with%20the%20latest%20csom%20or%20PNP.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKR%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPaul%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-13957%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20List%20View%20WebPart%20Toolbar%20Type%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-13957%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Paul%2C%3C%2FP%3E%3CP%3EI%20have%20tried%20that.%20The%20thing%20is%20that%20so%20called%20'Show%20Toolbar'%20mode%2C%20adds%20another%20attribute%20to%20toolbar%20node.%3C%2FP%3E%3CP%3EIt%20looks%20like%20Toolbar%20Type%3D'Standard'%20ShowAlways%3D'TRUE'.%3C%2FP%3E%3CP%3EAny%20change%20one%20tries%20to%20make%2C%20doesn't%20effect%20toolbar%20behaviour.%3C%2FP%3E%3CP%3EEvent%20tried%20to%20change%20XmlDefinition%20directly%20and%20update%20the%20view.%20Nothing.%20%3A(%3C%2Fimg%3E%3C%2FP%3E%3CP%3EFunny%20thing%20however%2C%20if%20you%20do%20that%20using%20Sharepoint%20designer%2C%20and%20add%20that%20attr%20directly%20it%20works.%3C%2FP%3E%3CP%3EIn%20addition%20I%20see%20that%20in%20PnP%20provisioning%20framework%2C%20toolbar%20is%20removed%20from%20view%20definition.%26nbsp%3B%3C%2FP%3E%3CP%3EObject%20List%20Instance%20ExtractViews%20Method%20%3A%3C%2FP%3E%3CP%3E%2F%2F%20Toolbar%20is%20not%20supported%3C%2FP%3E%3CP%3Evar%20toolbarElement%20%3D%20schemaElement.Descendants(%22Toolbar%22).FirstOrDefault()%3B%3CBR%20%2F%3Eif%20(toolbarElement%20!%3D%20null)%3CBR%20%2F%3E%7B%3CBR%20%2F%3EtoolbarElement.Remove()%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-13953%22%20slang%3D%22en-US%22%3ERE%3A%20List%20View%20WebPart%20Toolbar%20Type%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-13953%22%20slang%3D%22en-US%22%3Ehi%20Alen%2C%20i%20think%20this%20is%20in%20the%20view%20please%20check%20out%20my%20blog%20about%20this%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.com%2Fpaul-keijzers%2F4594%2Funable-to-change-view-of-list-view-web-part-csom%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.com%2Fpaul-keijzers%2F4594%2Funable-to-change-view-of-list-view-web-part-csom%3C%2FA%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Is there a way to change toolbar type on ListView WebPart via CSOM?

It doesn't seem to work

6 Replies
Highlighted
hi Alen, i think this is in the view please check out my blog about this: https://docs.com/paul-keijzers/4594/unable-to-change-view-of-list-view-web-part-csom
Highlighted

Hi Paul,

I have tried that. The thing is that so called 'Show Toolbar' mode, adds another attribute to toolbar node.

It looks like Toolbar Type='Standard' ShowAlways='TRUE'.

Any change one tries to make, doesn't effect toolbar behaviour.

Event tried to change XmlDefinition directly and update the view. Nothing. :(

Funny thing however, if you do that using Sharepoint designer, and add that attr directly it works.

In addition I see that in PnP provisioning framework, toolbar is removed from view definition. 

Object List Instance ExtractViews Method :

// Toolbar is not supported

var toolbarElement = schemaElement.Descendants("Toolbar").FirstOrDefault();
if (toolbarElement != null)
{
toolbarElement.Remove();
}

Highlighted

Hi Alen,

 

that is strange you can not update the xml def but the view should be possible did it in my code as well.

Maybe it changed with the latest csom or PNP.

 

KR,

 

Paul

Highlighted

Hi Paul,

It works now. I managed to change toolbar type.

Actually it was the problem in  XsltWebPartPostProcessor Process method.

It invokes UpdateHiddenView(xsltHiddenView, listView.ListViewXml);

I have added overload with changed listviewSchemaXml as parameter, and update now works like a charm.

Thanks for help.

 

Alen

Highlighted

Cool so my post helped you a bit in the right direction ;)

Highlighted
Hi Alen,

Are you able to share some more details about what you needed to overload to resolve the issue?

-Troy