Closed swapnilgaonkar closed 4 years ago
Shouldn’t it be “Calendar”?
Can you provide a complete sample you’re trying?
I'm not even sure that it's feasible to create a Calendar view via REST API at all, no matter I tried copying all the fields from a view created in the UI. With REST, it always ends up with a default ViewTypeKind.
Also, I'm not sure, should we even consider adding CSOM helper(s) for this. View types are such on an old legacy that is never used at all these days. And are recommended not being used even in On-Prem and especially in SharePoint Online which is aiming away from classic outdated stuff.
Thanks for the help. We also tried all the combinations but still view gets created with default ViewTypeKind(HTML). We are ignoring view creation for time being as it is legacy functionality as you mentioned.
We are creating list views. During creation we are passing 'ViewType' as 'CALENDER' as mentioned below createMetadata["ViewType"] = "CALENDER". But still view gets created with type HTML.
Even if we try to create view of type field, 'ViewFields are not getting created.'
If we get existing list view using library code, we can see that all fields are present in 'ListViewXML' as below sample.
<View Name="{F2B2777A-7608-4EF8-80DC-786260376474}" Type="HTML" DisplayName="All Test Documents View" Url="/sites/commsite12/Shared Documents/Forms/All Test Documents View.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/dlicon.png?rev=47" ><Query><OrderBy><FieldRef Name="FileLeafRef" /></OrderBy></Query><ViewFields><FieldRef Name="DocIcon" /><FieldRef Name="LinkFilename" /><FieldRef Name="Modified" /><FieldRef Name="Editor" /><FieldRef Name="Mylocation" /><FieldRef Name="City" /><FieldRef Name="CountryOrRegion" /><FieldRef Name="SampleTest" /></ViewFields><RowLimit Paged="TRUE">30</RowLimit><Aggregations Value="Off" /><JSLink>clienttemplates.js</JSLink><XslLink Default="TRUE">main.xsl</XslLink><ViewData /><Toolbar Type="Standard"/></View>
For e.g. If we try to create new view using above ListViewXML, 'SampleTest' is not getting added to view.
Can you please provide some help