2

I'm deploying a web part page from a feature. In the module/file node, I defines a view to a specific list in the site :

<Module Name="SitePages"
      Url="SitePages"
      SetupPath="1033\STS\DOCTEMP\SMARTPGS" >

<File Name="parametres.aspx"
      Path="spstd4.aspx"
      Url="parametres.aspx"
      Type="GhostableInLibrary"> 
  <View WebPartOrder="3"
        WebPartZoneID="Body"
        DisplayName="Entités"
        List="Lists/Entities"  />
</File>
</Module>

This is working as expected, but I'd like to configure some advanced properties; For example, I want to define the audience that applies to the webpart. With a custom WebPart, I would have done :

  <AllUsersWebPart WebPartZoneID="Body"
                   WebPartOrder="2">
    <![CDATA[<webParts>

  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
  <type name="MyProject.MyWebPart, $SharePoint.Project.AssemblyFullName$" />
  <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
</metaData>
<data>
  <properties>
    <property name="Title" type="string">WP Title</property>
    <property name="Description" type="string">WP Description</property>
    <property name="AuthorizationFilter" type="string">;;;;Name_Of_My_SharePoint_Group</property>
  </properties>
</data>
</webPart>
</webParts>
]]>
  </AllUsersWebPart>

But using <view>, I don't have the properties node available.

What are my options ?

3

Try this :

<View WebPartOrder="3"  WebPartZoneID="Body"  DisplayName="Entités"  List="Lists/Entities">
                <![CDATA[
                <webParts>
                    <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                        <metaData>
                            <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
                            <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
                        </metaData>
                        <data>
                            <properties>
                             <property name="Title" type="string">WP Title</property>
                             <property name="Description" type="string">WP  Description</property>
                             <property name="AuthorizationFilter" type="string">;;;;Name_Of_My_SharePoint_Group</property>
                           </properties>
                        </data>
                    </webPart>
                </webParts>
                ]]>
            </View>
  • Amazing undocumented behavior. I owe you a beer (_)3 – Steve B Jun 8 '12 at 14:06
  • This is not Working..... – Harsh Bhavsar Jan 29 '14 at 11:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.