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 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 ?

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

Your Answer


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

Browse other questions tagged or ask your own question.