SP2013 Sandbox: How to add listview webpart to page?

I wanted to create a module to provision an aspx page with few listview webparts. I have no problem if list exist in page, but seems like this does not work if list are provisioned from the same solution. Perhaps Sharepoint randomizes guids or something like that. Any Ideas?
LVL 1
tolppaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
how are you currently trying to provision the web parts?

Have not tried it yet in 2013, but normally you would simply add a VIEW element to your page module like here

You just have to ensure that your list creation is executed BEFORE provisioning the page.

HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tolppaAuthor Commented:
I used sharepoint designer configured .aspx -file because it would make everything much easier. Apparently this does not work with views.

I created module that should create my page with views. Not too hard:

    <File Path="Pages\wkpstd.aspx" Url="MyTest.aspx"  Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
      <Property Name="WikiField" Type="string" Value="&lt;div class=&quot;ms-rtestate-read ms-rte-wpbox&quot; contentEditable=&quot;false&quot;&gt;&lt;div class=&quot;ms-rtestate-read 46113482-da36-45a5-bbac-e1e1771c19fa&quot; id=&quot;div_46113482-da36-45a5-bbac-e1e1771c19fa&quot;&gt;&lt;/div&gt;&lt;div style='display:none' id=&quot;vid_46113482-da36-45a5-bbac-e1e1771c19fa&quot;&gt;&lt;/div&gt;&lt;/div&gt; "/>
      <View List="Lists/MyList" BaseViewID="2" Type="HTML" WebPartZoneID="wpz" WebPartOrder="4" ID="g_46113482_da36_45a5_bbac_e1e1771c19fa" />
    </File>

Open in new window


Unfotunately I need more complex layout which can be created with:
<File Path="Pages\wkpstd.aspx" Url="mytest.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
<Property Name="WikiField" Value="&lt;table id=&quot;layoutsTable&quot; style=&quot;width:100%&quot;&gt;&lt;tbody&gt;&lt;tr style=&quot;vertical-align:top&quot;&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;div class=&quot;ms-rte-layoutszone-outer&quot; style=&quot;width:100%&quot;&gt;&lt;div class=&quot;ms-rte-layoutszone-inner&quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;vertical-align:top&quot;&gt;&lt;td style=&quot;width:49.95%&quot;&gt;&lt;div class=&quot;ms-rte-layoutszone-outer&quot; style=&quot;width:100%&quot;&gt;&lt;div class=&quot;ms-rte-layoutszone-inner&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;width:49.95%&quot;&gt;&lt;div class=&quot;ms-rte-layoutszone-outer&quot; style=&quot;width:100%&quot;&gt;&lt;div class='ms-rte-layoutszone-inner'&gt;&lt;/div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;vertical-align:top&quot;&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;div class=&quot;ms-rte-layoutszone-outer&quot; style=&quot;width:100%&quot;&gt;&lt;div class=&quot;ms-rte-layoutszone-inner&quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span id='layoutsData' style='display:none'&gt;true,true,2&lt;/span&gt;" />
</File>

Open in new window


I can see layout work correctly, but how do I add my views to page?  Something like:

Footer: <View List="Lists/MyList" BaseViewID="2" Type="HTML" WebPartZoneID="wpz" WebPartOrder="4" ID="g_46113482_da36_45a5_bbac_e1e1771c19fa" />

Left column (would be another view):  <View List="Lists/MyList" BaseViewID="2" Type="HTML" WebPartZoneID="wpz" WebPartOrder="4" ID="g_46113482_da36_45a5_bbac_e1e1771c19fa" />

(http://blog.mastykarz.nl/inconvenient-provisioning-web-parts-wiki-pages-sandboxed-solutions/)
0
tolppaAuthor Commented:
Interesting, seems like I can inject
&lt;div class=&quot;ms-rtestate-read ms-rte-wpbox&quot; contentEditable=&quot;false&quot;&gt;&lt;div class=&quot;ms-rtestate-read 46113482-da36-45a5-bbac-e1e1771c19fa&quot; id=&quot;div_46113482-da36-45a5-bbac-e1e1771c19fa&quot;&gt;&lt;/div&gt;&lt;div style='display:none' id=&quot;vid_46113482-da36-45a5-bbac-e1e1771c19fa&quot;&gt;&lt;/div&gt;&lt;/div&gt;

Open in new window


to my layout.
0
tolppaAuthor Commented:
No problem wiht single view, but seems like I am not able to add multiple views to different columns (table cells). SharePoint designer allow this.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.