AWG Blogs

  • Getting ADB Working for SPH-M840 - Had a SPH-M840 Galaxy Ring Virgin Mobile 3G Android version 4.1.2, attempting to install apps from Android Studio failed to detect device. Installed SAMSUN...
    6 months ago
  • How to check if I have write permissions to an Oracle table - SELECT CASE WHEN COUNT(*) > 0 THEN 'YES' ELSE 'NO' END AS PERMISSIONS FROM ( SELECT privilege FROM ( select * from dba_tab_privs where (grantee = 'MY_USE...
    6 months ago
  • JSF vs Struts 2 - JSF was designed in part by the authors of Struts to create a "Struts" that did a more accurate implementation of MVC (Struts is technically "Model 2") a...
    7 months ago
  • XML Beans vs JAXB - Seems XML Beans is superior: JAXB provides support for the XML schema specification, but handles only a subset of it; XMLBeans supports all of it. Also, by...
    11 months ago
  • Algorithms and OOP - In addition to DCI, "generic programming" as well as the move to functional programming appears to add nuance to the OOP notion of joining behavior with da...
    1 year ago
  • Flyweight vs Singleton - Implementations seems to be virtually identical, differing only in style, where the flyweight object is created and held by associated objects (containers:...
    1 year ago
  • init-param vs context-param - see for background. Gist: context-param variables are global and accessible thro...
    1 year ago
  • rbenv vs RVM - RVM is responsible not only for changing Ruby versions, but for installing rubies and managing gemsets, as well. ...Along with rbenv [to manage ruby versi...
    1 year ago

Friday, July 6, 2012

"Specified view is invalid" error when transferring .webpart

I couldn't figure out why SharePoint would produce ASP.NET error when importing a previously exported .webpart. The quick way to resolve it is to remove the ViewFlag element or set it to 0 in the .webpart file. But I found that when I do this the web part does not set ctx values, such as httpvdir. One workaround is to use Server variables rather than CAML variables in the .webpart's ParameterBinding value. I could also open the page in SPD, and make a minor change and save it, which fixes the problem. But I still need to determine what is causing the issue. (BTW, what does ViewFlag, or its absence, have to do with the issue, and what do the ViewFlag values mean anyways? No-one knows apparently).

I finally reproduced the issue in a simple case:
In SourceSiteCol, create a plain doc library and set ContentTypesEnabled to true ("Allow management of content types").
Save as list template. Copy this to DestSiteCol List template gallery.
On DestSiteCol subsite, create a list based on the uploaded list template.
In a web part page on this subsite, add a ListViewWebPart based on the created list. In SPD, convert it to a DataFormWebPart.
Export it as a .webpart. Then import into another web part page on the same site; the error occurs. Disabling Content type management for the created list makes the error go away. So the problem has something to do with Content Types...

At any rate, when transferring lists and their web parts to other sites, can edit the .webpart as follows:
Look for SelectParameters and change the Parameter with ListID to have ListName, and set its DefaultValue to the current display name of the target list (note, if the display name changes, your web part will break, and you'll have to fix the name in the XSLT).
Remove the  Update, Insert, and Delete params see (
Set TitleUrl property to the URL of the default view
Set the Title property to the intended title of the web part