I'm trying to create a custom view for a list with custom UI. The following is my code:
list.Views.Add("List View", coll, Query, 10, true, false);
list.Update();
SPView view = list.Views["List View"];
string contents = string.Empty;
WebRequest request = WebRequest.Create(SPContext.Current.Web.Url+"/_layouts/CustomViews/CustomBoxed.xml");
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
contents = reader.ReadToEnd();
}
response.Close();
view.SetViewXml(contents);
view.Title = "My List View";
view.Update();
The code is basically creating a view in the list, then updating the XML inside the view to display something different. However, on view.Update() I get this error: Cannot complete this action. Please try again
What I'm trying to accomplish: Show an entirely different UI to display the list items. I have gotten copy of the sharepoint VWSTYLES.XML and have used their styles, but that doesn't seem to work.
Thanks! And sorry if this question is a bit confusing.