I am attempting to create a filtered list view in a Calendar. It is creating everything as appropriate, but not creating the filters. It believe it's my CAML. My goal is to filter by a choice column named "Approval Status" with a value of "Approved":
function createCalendarView() {
var currentcontext = new SP.ClientContext.get_current();
var hostcontext = new SP.AppContextSite(currentcontext, hostweburl);
var context = SP.ClientContext.get_current();
var hostweb = hostcontext.get_web();
var listCollection = hostweb.get_lists();
var list = listCollection.getByTitle('Calendar');
// Create Approved PTO View
//get the view collection to add the view
var viewcollection = list.get_views();
//create a viewinfo with the view properties
var viewInfo = new SP.ViewCreationInformation(); //create multiple views
viewInfo.set_title("MYVIEW"); //set the title
viewInfo.set_viewTypeKind(524288);
viewInfo.set_setAsDefaultView(true); //set the view to default
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Where><Eq><FieldRef Name="Approval Status"/><Value Type="Text">Approved</Value></Eq></Where></View>');
viewInfo.set_query(camlQuery);
//add the view to the view collection
viewcollection.add(viewInfo);
//load the view collection
context.load(viewcollection);
context.executeQueryAsync(onCalendarViewCreationSuccess, onCalendarViewCreationFail);
}