Question

Can I conditionally hide properties being displayed using SPSWC:ProfilePropertyDisplayName and SPSWC:ProfilePropertyValue based on the field policy settings "Default Privacy Setting" (or the "Show To" option if "User can override" is checked) for the property? I'm using the following code to display the properties.

<tr>
    <td><SPSWC:ProfilePropertyDisplayName PropertyName="Hobbies" dir="ltr" runat="server"/>:</td>
    <td><SPSWC:ProfilePropertyValue PropertyName="Hobbies" dir="ltr" runat="server"/></td>
</tr>
<tr>
    <td><SPSWC:ProfilePropertyDisplayName PropertyName="Activities" dir="ltr" runat="server"/>:</td>
    <td><SPSWC:ProfilePropertyValue PropertyName="Activities" dir="ltr" runat="server"/></td>
</tr>
<tr>
    <td><SPSWC:ProfilePropertyDisplayName PropertyName="Allergies" dir="ltr" runat="server"/>:</td>
    <td><SPSWC:ProfilePropertyValue PropertyName="Allergies" dir="ltr" runat="server"/></td>
</tr>

This is related to another question about user profile properties.

Thanks!

Était-ce utile?

La solution

For conditionally hiding or changing properties like this, I typically do it via jQuery on the rendered page. If you want to do it based on the privacy settings in the manner you are working now, I'm afraid that you would need to create a custom control that replaces the PropertyValue control.

Autres conseils

Just a guess, but the User Profile Service should handle that for you. When the user changes the display property requests for the property will not be returned to users who do not have the rights.

Have you tried it? What were the results?

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top