Creating views with explicit attribute

%3CLINGO-SUB%20id%3D%22lingo-sub-49417%22%20slang%3D%22en-US%22%3ECreating%20views%20with%20explicit%20attribute%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49417%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20a%20list%20based%20on%20media%20contenttypes.%20When%20we%20provision%20them%20with%20this%20xml%3A%3C%2FP%3E%3CPRE%3E%26lt%3BView%20Name%3D%22%7B2AC983A0-C495-4358-B821-7A465635AE08%7D%22%20Type%3D%22HTML%22%20DisplayName%3D%22All%20Assets%22%20Url%3D%22%2Fsites%2FPEX1000%2FMediaLibrary%2FForms%2FAll%20Assets.aspx%22%20Level%3D%221%22%20BaseViewID%3D%2240%22%20ContentTypeID%3D%220x%22%20ImageUrl%3D%22%2F_layouts%2F15%2Fimages%2Fdlicon.png%3Frev%3D44%22%20%26gt%3B%26lt%3BQuery%26gt%3B%26lt%3BOrderBy%26gt%3B%26lt%3BFieldRef%20Name%3D%22LinkFilename%22%20%2F%26gt%3B%26lt%3B%2FOrderBy%26gt%3B%26lt%3B%2FQuery%26gt%3B%26lt%3BViewFields%26gt%3B%26lt%3BFieldRef%20Name%3D%22ContentType%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22DocIcon%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22LinkFilenameNoMenu%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22Modified%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22Editor%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22MediaLengthInSeconds%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22NameOrTitle%22%20Explicit%3D%22TRUE%22%20CalloutMenu%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22FileSizeDisplay%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22ImageSize%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22ImageWidth%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22ImageHeight%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoWidthInPixels%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoHeightInPixels%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22PreviewOnForm%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22Created_x0020_Date%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22Author%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22_Comments%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22PeopleInMedia%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetDescription%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetOwner%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetUserOverrideEncoding%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetDefaultEncoding%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetExternalLink%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetShowDownloadLink%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetShowEmbedLink%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3BFieldRef%20Name%3D%22VideoSetRenditionsInfo%22%20Explicit%3D%22TRUE%22%20%2F%26gt%3B%26lt%3B%2FViewFields%26gt%3B%26lt%3BRowLimit%20Paged%3D%22TRUE%22%26gt%3B20%26lt%3B%2FRowLimit%26gt%3B%26lt%3BJSLink%26gt%3Bclienttemplates.js%7CSP.UI.TileView.js%7CSP.UI.AssetLibrary.js%7Ccallout.js%26lt%3B%2FJSLink%26gt%3B%26lt%3BXslLink%26gt%3BAssetPicker.xsl%26lt%3B%2FXslLink%26gt%3B%26lt%3BToolbar%20Type%3D%22Standard%22%2F%26gt%3B%26lt%3B%2FView%26gt%3B%3C%2FPRE%3E%3CP%3EIt%20shows%20only%20default%20values%20and%20does%20not%20show%20data%20when%20i%20upload%20a%20file%20in%20the%20columns%20of%20the%20view.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20use%20the%20following%20code%3A%3C%2FP%3E%3CPRE%3E%20%20var%20newView%20%3D%20createdList.Views.Add(new%20ViewCreationInformation%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Title%20%3D%20viewTitle%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20newView.ListViewXml%20%3D%20view.SchemaXml%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20newView.Update()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20newView.EnsureProperties(v%20%3D%26gt%3B%20v.Id)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20web.Context.ExecuteQueryRetry()%3B%3C%2FPRE%3E%3CP%3Eplease%20let%20me%20know%20if%20you%20know%20a%20solution%20for%20this%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-49417%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Edeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Deleted
Not applicable

We have a list based on media contenttypes. When we provision them with this xml:

<View Name="{2AC983A0-C495-4358-B821-7A465635AE08}" Type="HTML" DisplayName="All Assets" Url="/sites/PEX1000/MediaLibrary/Forms/All Assets.aspx" Level="1" BaseViewID="40" ContentTypeID="0x" ImageUrl="/_layouts/15/images/dlicon.png?rev=44" ><Query><OrderBy><FieldRef Name="LinkFilename" /></OrderBy></Query><ViewFields><FieldRef Name="ContentType" /><FieldRef Name="DocIcon" /><FieldRef Name="LinkFilenameNoMenu" /><FieldRef Name="Modified" /><FieldRef Name="Editor" /><FieldRef Name="MediaLengthInSeconds" /><FieldRef Name="NameOrTitle" Explicit="TRUE" CalloutMenu="TRUE" /><FieldRef Name="FileSizeDisplay" Explicit="TRUE" /><FieldRef Name="ImageSize" Explicit="TRUE" /><FieldRef Name="ImageWidth" Explicit="TRUE" /><FieldRef Name="ImageHeight" Explicit="TRUE" /><FieldRef Name="VideoWidthInPixels" Explicit="TRUE" /><FieldRef Name="VideoHeightInPixels" Explicit="TRUE" /><FieldRef Name="PreviewOnForm" Explicit="TRUE" /><FieldRef Name="Created_x0020_Date" Explicit="TRUE" /><FieldRef Name="Author" Explicit="TRUE" /><FieldRef Name="_Comments" Explicit="TRUE" /><FieldRef Name="PeopleInMedia" Explicit="TRUE" /><FieldRef Name="VideoSetDescription" Explicit="TRUE" /><FieldRef Name="VideoSetOwner" Explicit="TRUE" /><FieldRef Name="VideoSetUserOverrideEncoding" Explicit="TRUE" /><FieldRef Name="VideoSetDefaultEncoding" Explicit="TRUE" /><FieldRef Name="VideoSetExternalLink" Explicit="TRUE" /><FieldRef Name="VideoSetShowDownloadLink" Explicit="TRUE" /><FieldRef Name="VideoSetShowEmbedLink" Explicit="TRUE" /><FieldRef Name="VideoSetRenditionsInfo" Explicit="TRUE" /></ViewFields><RowLimit Paged="TRUE">20</RowLimit><JSLink>clienttemplates.js|SP.UI.TileView.js|SP.UI.AssetLibrary.js|callout.js</JSLink><XslLink>AssetPicker.xsl</XslLink><Toolbar Type="Standard"/></View>

It shows only default values and does not show data when i upload a file in the columns of the view.

 

I use the following code:

  var newView = createdList.Views.Add(new ViewCreationInformation
                {
                    Title = viewTitle
                });
                newView.ListViewXml = view.SchemaXml;
                newView.Update();
                newView.EnsureProperties(v => v.Id);
                web.Context.ExecuteQueryRetry();

please let me know if you know a solution for this issue.

0 Replies