tag:blogger.com,1999:blog-9049032025342264339.post4015114255746967884..comments2024-03-29T10:44:10.455+03:00Comments on sadomovalex's blog: Provision list view web parts declaratively and modify their views in SharepointAlexey Sadomovhttp://www.blogger.com/profile/18112105989691733410noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-9049032025342264339.post-80194731110924297542014-10-21T23:23:03.133+04:002014-10-21T23:23:03.133+04:00if your goal is to get rid of the code, it is wort...if your goal is to get rid of the code, it is worth to try. However before to go this direction I recommend to try provision list view web part and specify view id of some existing list using BaseViewID attribute just in order to be sure that with View element existing predefined views can be used.Alexey Sadomovhttps://www.blogger.com/profile/18112105989691733410noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-1235277589777457802014-10-21T23:03:07.568+04:002014-10-21T23:03:07.568+04:00What do you think about the following alternative ...What do you think about the following alternative to your approach:<br />1. Create List Definitions (based/inheriting from existing definitions, e.g. Document Library) as Feature (not in the onet.xml, or we get other kinds of problems)<br />2. In the custom list definition create a new view which has all those queries, row limits and etc<br />3. In the View you are describing, specify the customHYhttps://www.blogger.com/profile/07286081906176391131noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-51300238260988728472014-10-21T22:27:38.840+04:002014-10-21T22:27:38.840+04:00I didn't faced with exactly this problem but e...I didn't faced with exactly this problem but easily accept that this property may be ignored.Alexey Sadomovhttps://www.blogger.com/profile/18112105989691733410noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-69858953942096233062014-10-21T17:39:59.691+04:002014-10-21T17:39:59.691+04:00Hi,
But do you confirm the issue that XsltListView...Hi,<br />But do you confirm the issue that XsltListViewWebPart ignores the XmlDefinition property?HYhttps://www.blogger.com/profile/07286081906176391131noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-24455663782952089972014-10-21T17:25:55.708+04:002014-10-21T17:25:55.708+04:00Hristo,
yes, like shown in the post above, it firs...Hristo,<br />yes, like shown in the post above, it firsts provisions list view web part on the page declaratively (note that it is simpler to provision list view web part using View element instead of AllUsersWebPart like you try to do) and then in feature receiver modifies the created view via code.Alexey Sadomovhttps://www.blogger.com/profile/18112105989691733410noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-2461443332669533872014-10-21T16:23:00.914+04:002014-10-21T16:23:00.914+04:00Are you using the combination of declaration/code ...Are you using the combination of declaration/code because you have encountered similar problem to this - https://social.msdn.microsoft.com/Forums/en-US/26720926-619c-4d7d-aaa8-c427f87e65a6/xsltlistviewwebpart-ignores-xmldefinition-property - when you go entirely for the declaration approach (i.e. AllUsersWebPart -> XsltListViewWebPart)HYhttps://www.blogger.com/profile/07286081906176391131noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-28565650540545987812013-12-09T17:15:52.985+04:002013-12-09T17:15:52.985+04:00thanks, i willthanks, i willAnonymoushttps://www.blogger.com/profile/13112511116153245282noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-25640247131344801262013-12-09T17:04:09.828+04:002013-12-09T17:04:09.828+04:00> At the same time, view tag in the file elemen...> At the same time, view tag in the file element exactly provisions the view webpart to the page. Or i am mixing some not related stuff?<br /><br />you are not mixing it. Yes View tag provisions the web part. But also it adds hidden list view to the list and the post was about modifying of this list view only. Try the second link from my previous comment. I used this solution in several Alexey Sadomovhttps://www.blogger.com/profile/18112105989691733410noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-88787231519182298522013-12-09T15:43:24.698+04:002013-12-09T15:43:24.698+04:00Deleted the previous comment, there were few typos...Deleted the previous comment, there were few typos: Thanks, yes, i have noticed the problem is old as universe, i was struggling with it in 2010 projects at least. But, now i got a bit confused. Yes, your code is about modifying the list view, not about xsltviewwebpart. At the same time, view tag in the file element exactly provisions the view webpart to the page. Or i am mixing some not related Anonymoushttps://www.blogger.com/profile/13112511116153245282noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-33706504980123908882013-12-09T15:22:14.403+04:002013-12-09T15:22:14.403+04:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/13112511116153245282noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-54038231030758536962013-12-09T15:20:22.251+04:002013-12-09T15:20:22.251+04:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/13112511116153245282noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-28812785098269060672013-12-09T13:39:16.439+04:002013-12-09T13:39:16.439+04:00This guy reverse engineered original obfuscated co...This guy reverse engineered original obfuscated code of the method which sets toolbar type from IL code, which worth respect.Alexey Sadomovhttps://www.blogger.com/profile/18112105989691733410noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-81606515444817521922013-12-09T13:33:58.595+04:002013-12-09T13:33:58.595+04:00hi Ivan,
as far as I understand you are talking ab...hi Ivan,<br />as far as I understand you are talking about provisioning of the whole list view web part programmatically. In the post above I described how to modify list view (not list view web part), which was created in the list during declarative provisioning of list view web part. I.e. in example above lvwp was provisioned still declaratively, while only list view was modified Alexey Sadomovhttps://www.blogger.com/profile/18112105989691733410noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-36926246816553866062013-12-09T09:22:30.937+04:002013-12-09T09:22:30.937+04:00Hi, thanks for the article, but i have a problem p...Hi, thanks for the article, but i have a problem provisioning views this way, maybe you know some workaround as well. The view which is provisioned declaratively, looks different. I am setting baseviewid and it works great, but the toolbar type is usually specified as "standard", however, add new item missing (and drag and drop new file in case of document library view, i am talking Anonymoushttps://www.blogger.com/profile/13112511116153245282noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-41798691339022005702013-05-26T19:37:30.949+04:002013-05-26T19:37:30.949+04:00hello Dmitry,
this is a problem indeed. As workaro...hello Dmitry,<br />this is a problem indeed. As workaround you may check in what order web parts are provisioned and change event receiver logic according to this order. Fast, but not reliable.<br />As another solution you may enumerate all list view web parts on the page using LimitedWebPartManager and try to retrieve target view id programmatically in event receiver (as far as I remember Alexey Sadomovhttps://www.blogger.com/profile/18112105989691733410noreply@blogger.comtag:blogger.com,1999:blog-9049032025342264339.post-40800455146413177642013-05-26T00:29:12.066+04:002013-05-26T00:29:12.066+04:00Great, but happens if we provision list view web p...Great, but happens if we provision list view web part to default.aspx and default2.aspx? What we should specify in the LastOrDefault() expression? How to recognize which hidden view belongs to specific aspx page?Dmitrii Dolotovskikhhttps://www.blogger.com/profile/13762433248088603336noreply@blogger.com