I have a module that deploys some page.

I'm adding webparts to these page, using a <AllUsersWebPart> node within a <View>:

  <View WebPartZoneID="Body"
        Name="My Title">
    <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
            <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
            <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
              <property name="Title" type="string">My title</property>
              <property name="AllowHide">False</property>
              <property name="AllowMinimize">False</property>
              <property name="AuthorizationFilter">;;;;MySharepointGroup</property>
              <property name="IsIncludedFilter">;;;;MySharepointGroup</property>

As you can see, I'm trying to set the audience of the webpart to a specific SharePoint group, but this does not works as expected.

If I:

  • don't include neither AuthorizationFilter nor IsIncludedFilter, the webpart is displaying as I expect, but for all users
  • include AuthorizationFilter but not IsIncludedFilter, the webpart is displaying as I expect, but still for all users.
  • include both AuthorizationFilter and IsIncludedFilter. this time, the webpart is in error, with this error :

[WebPartPageUserException: The file format is not valid. Try importing a Web Part file (.WebPart).] at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateWebPart(Boolean clearConnections) at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, Uri webPartPageUri, SPWeb spWeb) at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CompressWebPartNoSave(Boolean isClosed)

In the ULS log, there is exactly the same message, with no more error or warning.

I know I could set this audience from code, but I'd like keep my full declarative model.

What is the correct way to setup audience from xml ?

  • Did you ever find a solution to this?
    – tarjeieo
    Sep 3, 2012 at 12:30
  • Unfortunately, no. I set up the audiences from a feature receiver.
    – Steve B
    Sep 4, 2012 at 8:39
  • Yup, that's what I ended up with as well
    – tarjeieo
    Sep 10, 2012 at 8:35

1 Answer 1


i know it is a bit late but i was just involved in a similar Scenario: I used the MembersWebPart in SharePoint 2013 and this is a working example:

<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
    <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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