Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 ?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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>
share|improve this answer
    
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 at 11:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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