2

I created following listView through Visual Studio in my List on SharePoint-Hosted Add-in project:

enter image description here

Where i created listView - Generated xml like this:

<View BaseViewID="2"
 Name="2930629c-f218-4951-baca-ff0beea837bc"
 DisplayName="My holidays"
 Type="HTML" 
 WebPartZoneID="Main"
 SetupPath="pages\viewpage.aspx"
 Url="MyHolidays.aspx">
<RowLimit>30</RowLimit>

I insert This query for current view where show my holidays:

<Query>
   <OrderBy><FieldRef Name="ID"></FieldRef></OrderBy>
   <Where>
      <Eq>
         <FieldRef Name="Author" />
         <Value Type="User">[Me]</Value>
      </Eq>
    </Where>
</Query>

How to render this view in my .asp page?

This is my code in default.aspx page, where i need to show My holidays view:

<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">
<WebPartPages:WebPartZone runat="server"
    FrameType="TitleBarOnly" ID="full" Title="loc:full">
    <WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart2"
        runat="server" ListUrl="Lists/Holidays" IsIncluded="True"
        NoDefaultStyle="TRUE" Title="Images used in switcher"
        PageType="PAGE_NORMALVIEW" Default="False"
        ViewContentTypeId="0x" ViewId="2">
    </WebPartPages:XsltListViewWebPart>
</WebPartPages:WebPartZone>

1) Is it true my query?

2) I dont know ViewID="2" is correct to render "My holidays" view.

.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.