Profiel van BryanSharePoint o RamaWeblogLijsten Extra Help

Weblog


    04 mei

    Anonymous Audiences in MOSS

    In a past project, I needed to be able to create an audience in MOSS that would apply only to anonymous users in an SharePoint site configured to use forms-based authentication.  Additionally, anonymous users could not access a page in SharePoint if the page contained a web part that was configured with an audience.

    I noticed that the RuntimeFilter tag in the web.config file referenced the AudienceManager class: 

    <RuntimeFilter Assembly="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Class="Microsoft.Office.Server.Audience.AudienceManager" BuilderURL="audience_chooser.aspx" />

    Using Reflector, I was able to determine that this class was responsible for both supplying the audience controls in the tool part window and for determining whether or not the user was in the audience configured for the web part. 

    Normally, these controls are displayed when a web part is edited:

    image

    But after writing a wrapper for the AudienceManager class, I was able to add an additional checkbox to allow the user to specify that only anonymous users should see the webpart:

    image

    Now, when the user checks the check box, only anonymous users will see the web part.  I also made an additional change to workaround the problem of anonymous users not being able to see pages that had web parts configured with audiences.

    To implement the same functionality, you will need two classes:  one that implements the Microsoft.SharePoint.WebPartPages.IRuntimeFilter2 interface and one that implements the Microsoft.SharePoint.WebPartPages.IToolPaneControl interface.  The IRuntimeFilter2 interface is used to determine if the current user is in a particular audience when the web page is rendering and the class you create will need to be configured in the RuntimeFilter tag in the web.config file.  The IToolPaneControl interface is used to display the audience control in the tool pane when the web part is edited.

    You can download the code I used here.

    Technorati Tags: ,

    (6) reacties

    Een ogenblik geduld...
    De reactie die je hebt ingevoerd is te lang. Maak hem iets korter.
    Je hebt niets ingevoerd. Probeer het opnieuw.
    We kunnen je reactie nu niet toevoegen. Probeer het later opnieuw.
    Je hebt toestemming van je ouders nodig om een reactie toe te voegen Toestemming vragen
    Je kunt geen reacties geven omdat je ouders dit hebben uitgeschakeld.
    We kunnen je reactie nu niet verwijderen. Probeer het later opnieuw.
    Je hebt het maximale aantal reacties overschreden dat je elke dag kunt versturen. Probeer het over 24 uur nog eens.
    De mogelijkheid om reacties te geven is uitgeschakeld voor je account omdat onze systemen aangeven dat je spam naar andere gebruikers verzendt. Als je van mening bent dat je account ten onrechte is uitgeschakeld, kun je contact opnemen met de klantondersteuning van Windows Live.
    Voer de beveiligingscontrole hieronder uit om een reactie achter te laten.
    De tekens die je typt moeten overeenkomen met die in de afbeelding of het audiofragment.
    Bryan Phillips heeft het achterlaten van reacties uitgeschakeld.
    Julianzegt:
    This is great thanks very much.

    However I would like to be able to use Anonymous Users Only option for navigation items on a publishing site. Modifying a global or current navigation item brings up the AddNavigationLinkDialog.aspx page unlike webparts which are modified with the tool pane. The AddNavigationLinkDialog.aspx is not showing the Anonymous Users Only? option. Can this .apx be adapted to support anonymous audiences?
    23 Apr.
    I tryed the entry posted by Rich and it did not work.
    This is the correct web.config entry:
    <RuntimeFilter Assembly="AnonymousAudience, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8fbb4c5530367aa9" Class="AnonymousAudience.AnonymousAudienceManager" BuilderURL="audience_chooser.aspx" />
    18 Mar.
    You will have to manually add the change to your web.config file if the feature is deployed to extended web applications.  This is due to a bug in the SPWebConfigModification classes in SharePoint.
    18 Nov.
    Afbeelding van Anoniem
    Rich zegt:
    Once activated you need to change the web.config entry to:
     
    <RuntimeFilter Assembly="AnonymousAudience, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8fbb4c5530367aa9" Class="AnonymousAudienceManager" BuilderURL="audience_chooser.aspx" />
     
    then it works fine.
    13 Nov.
    Paulzegt:
    Hi,
     
    I was able to download, Deploy, and Activate your anonymousaudience feature, but webparts on an existing publishing site do not show the Anonymous Users Only check box under the Targeted Audiences field.
     
    Feature is listed and activated under Web Application features for the web app. Also did an IIS reset after deployment. Any thoughts?
     
    Paul Grafelman
    28 Okt.
    Afbeelding van Anoniem
    yuko zegt:
    Thank you very much.
    This is good stuff!
    20 Aug.

    Links naar je weblog (1)

    De URL voor de link naar dit weblogitem is:
    http://bphillips76.spaces.live.com/blog/cns!F9B548E4C21D6166!442.trak
    Weblogs die naar dit item verwijzen