DeleteView Function Prompting For Credentials [UPDATE]

Mar 9, 2012 at 5:24 PM

I am a Site Collection Admin on a site. Something happened and I have a few lists that have several extra view on them that I do not know where they came from. I decided to use SPService to get the views with GetViewCollection which works fine. As soon as I use DeleteView, I get prompted for a username/password and am not sure why this occurs. Any thoughts??

Mar 9, 2012 at 5:40 PM
Edited Mar 9, 2012 at 6:02 PM

I've seen views being created on their own after creating a DVWP, exporting, then importing to another page.  That may be what's going on.  Not sure why you would get prompted for a login though.

*edit*

I wanted to note, I've not tracked down the cause of the extra view creation, I've only noticed it.  It'd be nice to know why it happens sometimes.

Cheers,

Matt

Coordinator
Mar 12, 2012 at 2:43 AM

Wouldn't it be easier to just open the site up with SPD, navigate to the list, and delete the aspx file for the view?

As for views creating themselves, I've never seen that. However, I never export and import DVWPs.

M.

Mar 12, 2012 at 11:28 AM

I should have been more clear! The "views" I am trying to delete were not created by exporting/importing DVWPs because I never did that. The "views" exist in one list but point to custom forms in a completely different list that I can not delete! I do not know what I did in SPD to create the "views" but I can't delete them from there! I used the GetViewCollection method to verify that the views were actually there and they are, but the URL definitely points to a different list and form. Very strange! I just can't seem to run the DeleteView method as it then prompts for credentials that I don't have because of CAC authentication.

Mar 30, 2012 at 4:48 PM

With some effort and help from a team member, we have discovered what was causing the extra views! It is also easy to reproduce this. I have a list called Test Events and they are related to a list called Test Programs. In the custom view form for Test Programs I had created a DataFormWebPart to show a customized view of the Test Events to filter the ones related to the currently viewed Test Program. This worked great, but this created a view in Test Events and this was a problem! It turns out that there are 2 parameters on here that can cause this. In Designer the ViewFlag was set to 0 (Zero) and the DisplayName was set to "Test Events". We found that if you set the ViewFlag to 9 and the DisplayName to blank ("") and then delete the WebPartId and ID attributes, when you save it, Designer will have to recreate the WebPartID and ID attribute and the extra view will go away! This was a thorn in my side!