Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

September 25 2011

15:41

Using User Profile Property Values for List Filtering in SharePoint

Every other month or so, we receive an enquiry like the following:

Is it possible to filter (using FilterZen) a standard Document Library by a specific user profile field such as Department, where Department is also a field in the List / Library? I cannot see a way of doing it like the out-of-the-box Current User Filter Web Part.

Can do! With a few tweaks. Truth be told, we've been meaning to roll out first-class native FilterZen support for the SharePoint Server (MOSS / SPS) User Profiles model for a bit now. We expect to finalize an update for this by early October 2011, ie. in the next 1-2 weeks.

But that's no excuse not to implement such a requirement in FilterZen right now, with the current version you have now available. Of course, if you're on MOSS 2007 / SPS 2010, you could just use the out-of-box Current User Filter Web Part right away and skip FilterZen entirely — but if you have other filters for your List or Library you'd like to apply with FilterZen, integrating a User Profile Property into your main FilterZen Web Part is an understandable need and this is how you do it:

Let's work from the original enquiry above. You have a List View / Library View Web Part on your page (or you work directly on a View Page for that Library) and the Library contains a Department field. We want to filter so that only documents are shown that apply to the current user's Department, as stored in the corresponding User Profile Property.

For now there are no other Web Parts on the page. Add to it an out-of-box Current User Filter Web Part, a FilterZen Transformer Web Part and a FilterZen Filter Web Part, in that order. Do not connect any Web Parts at this point. Since you can freely re-arrange the order of Web Parts on the page interactively, be sure we have the following Web Part order:

  1. Out-of-box Current User Filter Web Part
  2. FilterZen Transformer Web Part
  3. FilterZen Filter Web Part
  4. Your Library View Web Part

1. The Current User Filter Web Part

  • For Filter Name, specify TempDepartment
  • Under Select value to provide, pick Department
  • Under Advanced Filter Options, tick the Send Empty if there are no values check-box option

2. The FilterZen Filter Web Part

Apart from any other filters your FilterZen Filter Web Part may contain, you will add a Text Filter named Department. This filter name refers not to the User Profile Property but to the target Library Field it is filtering! Apart from the name, the only other setting you need to set for this Text Filter is the default value which you will set to {$TempDepartment$} (or whatever name you used in step 1.)

3. Web Part Connections

Only now do you connect all Web Parts on the page, exactly as follows and exactly in this order:

  • From the Connections sub-menu of the FilterZen Transformer Web Part, select ICellConsumer (Get Cell From) and then pick your Current User Filter Web Part.
  • From the Connections sub-menu of the FilterZen Transformer Web Part, select IRowProvider (Send Row To) and then pick your FilterZen Filter Web Part.
  • From the Connections sub-menu of the FilterZen Filter Web Part, select Send Filter Values To and then pick your List View / Library View Web Part.

At first glance, this possibly looks more complicated than it really is — in fact, it's a fairly straightforward sequence of simple steps, really! With the next FilterZen, as usual things will be even easier and even faster to implement. But even now, FilterZen's core flexibility let's you combine the (very few) remaining not-yet-fully-absorbed skills of out-of-box Filter Web Parts with its many rock-solid and tremendously useful capabilities already provided.

This was just one example of how experimentation with core building blocks and re-using basic capabilities can take you far beyond the myriad of built-in, "typical" turn-key use-cases. So keep exploring!

February 20 2011

09:53

PeopleZen Data Field Templates: one new feature, many new possibilities

Lately we received a number of feature requests that could all be addressed by a single feature we've been meaning to add for quite some time, so we finally implemented it for the 1.9 release of PeopleZen: Customizable Data Field Templates.

Simply put, this gives you an easy tool that lets you fully redefine how PeopleZen displays or transforms certain user information, which is typically returned in rather raw form by your Data Source and may not be ready for human consumption as is.

PeopleZen has since its inception for many a common User Profile Property adopted "the most meaningful or usable way to display it", based on hard-coded heuristics driven initially by educated guesses and then increasingly by user feedback:

  • multi-valued properties are displayed comma-separated (but this is configurable)
  • email addresses are typically displayed as hyperlinks
  • date/time values are slightly re-formatted
  • all other information is displayed as plain text

But even if PeopleZen gets 90% of your needs right, out of the box, sometimes your users require more sophistication unique enough to your organization that we cannot simply hard-code it into the tool for everyone. Instead, with the new Custom Data Field Templates feature you can easily define your custom property display logic yourself — without having to struggle with messy XSLT.

Because this feature is so flexible, we will walk you through three real-world scenario of our users (anonymized) and how this new feature lets them implement their requirements:

Scenario 1: a better Manager field

Real-world user request:

I'm showing Manager as a column in my newest iteration. I'd like to display that as a clickable link to the manager's profile page (just like the main link in the far left column). Can I do that and at the same time show the person name rather than account name?

So by default the Manager user profile property stores just the account name / domain login name (ie. in the yourdomain\user123 pattern). Instead, this PeopleZen user wants to:

  1. show the real name (in a Farm User Profiles Data Source, this would be the PreferredName user profile property)
  2. and link it to the manager's profile page

Here are the steps to achieve this:

  • go to Site Settings / PeopleZen Studio / Data Field Templates and add a new Data Field Template. If you do not have any yet, simply use the form readily shown to add one:
    • Name: ShowManager
    • Content mode: HTML source code
    • Template content: <a href="{UserProfiles_PropertyValue;#AccountName;#[Manager];#rox___pu}">{UserProfiles_PropertyValue;#AccountName;#[Manager];#PreferredName}</a>
  • after saving this, replace your previous, unsatisfactory Manager field (in the User Profile Properties section of your PeopleZen Web Part's settings tool pane, and/or in the Default Data Fields setting on the Data Fields tab of your Data Source under Site Settings / PeopleZen Studio / Data Sources) with the following line:
    • {ShowManager}:Manager

The part after the colon is simply the display name of your field as shown to end users. The part before the colon, where you would typically specify a Data Source field, now instead references your own Data Field Template which you called ShowManager.

Inside this template, we used a similar (but a tad more complex) {placeholder syntax} to:

  • obtain both the PreferredName of the manager for the display text inside the <a> hyperlink
  • obtain for the <a href> attribute the profile page URL for which the special built-in field name rox___pu is used (which points back to the Link URL data field/s setting on the Data Source's Data Fields tab)

Inside your template you could use the same {placeholder syntax} to "call" any of your other Data Field Templates, if you have more than one. In fact this is precisely what is happening here -- a call to "another template" -- only you have never defined a template named UserProfiles_PropertyValue before, instead it is already built into PeopleZen and is simply a "predefined template" performing some very specific logic. In the above examples, when invoking the UserProfiles_PropertyValue template, it requires and is given three values:

  1. the User Profile Property to match with the next (2nd) given value. That property is AccountName for Farm User Profiles Data Sources.
  2. the value to obtain the User Profile to use for the next (3rd) given value. We pass [Manager] so now the template knows: pick the user profile whose AccountName is the Manager field of the current user profile.
  3. the property value to obtain from the fetched user profile. In this case, we want to show the PreferredName inside the link and for its URL, the rox___pu user profile page link.

All values given to a template are separated from each other and from the template name with SharePoint's ubiquitous ;# separator. So this is how you end up with an initially scary-looking, but ultimately very simple definition such as {UserProfiles_PropertyValue;#AccountName;#[Manager];#PreferredName}...

Scenario 2: display a field value but linked to a custom-composed dynamic URL

The next scenario is pretty similar in kind:

We need a special formatting for a certain Data Field in the rendered PeopleZen Web Part: <a href="http://roxority.com/ats/pages.aspx?param2=CurrentlyLoggedOnUser">datafieldValue</a> — is it possible to render a Data Field as a hyperlink exactly like in that example? All values in the column should have that rendering format. The currently logged-on user is also needed!

The steps are almost identical to scenario #1 above but let's walk through them again:

  • go to Site Settings / PeopleZen Studio / Data Field Templates and add a new Data Field Template. If you do not have any yet, simply use the form readily shown to add one:
  • after saving this, add your custom linked field to your user profile lists (via the User Profile Properties section of your PeopleZen Web Part's settings tool pane, and/or in the Default Data Fields setting on the Data Fields tab of your Data Source under Site Settings / PeopleZen Studio / Data Sources) with the following line:
    • {CustomLink}:Field Title

The part after the colon is simply the display name of your field as shown to end users. The part before the colon, where you would typically specify a Data Source field, now instead references your own Data Field Template which you called CustomLink.

Inside this template, we used a similar {placeholder syntax} to obtain the acount name of the current calling SharePoint user via the special, built-in "template" {UserProfiles_CurrentUser}. Note that the use of [Department] is just an example, this user probably wanted to show another User Profile Property but didn't tell us which. So replace [Department] with another know User Profile Property as required.

Scenario 3: Date/Time conversions

Real-world user request:

Our date of birth and hire date are entered into AD as Long Integers (ie. 122918688000000000 for 7/6/1990). Is there a way in PeopleZen to convert these to "human readable" dates?

Here you do not even really need to define your own custom Data Field Template. Simply replace your

  • SPS-Birthday:Birthday (or SPS-HireDate:Hire Date etc.)

or similar line (via the User Profile Properties section of your PeopleZen Web Part's settings tool pane, and/or in the Default Data Fields setting on the Data Fields tab of your Data Source under Site Settings / PeopleZen Studio / Data Sources) with any one of the following:

  • {DateTime_FromBinary;#[SPS-Birthday]}:Birthday
  • {DateTime_FromFileTime;#[SPS-Birthday]}:Birthday
  • {DateTime_FromFileTimeUtc;#[SPS-Birthday]}:Birthday
  • {DateTime_FromTicks;#[SPS-Birthday]}:Birthday

These are simply different conversion functions for long integer representations of date/time values. Try them all if you're not sure which long format your Data Source's date/time values are in fact using.

October 09 2010

20:47

Sync User Profiles' Picture URL with Active Directory images (thumbnailPhoto / jpegPhoto)

As you know, the SharePoint 2010 User Profile synchronization features sync up all your people data as stored in Active Directory (or other LDAP service) — except your profile pictures, if your AD uses the jpegPhoto or thumbnailPhoto properties for those.

The main reason for this is quite simply that the PictureURL property is a URL field (storing only the HTTP address pointing to a picture file), whereas AD stores the entire image itself as a "binary large object" (blob). So any synchronization will involve downloading the pictures stored in AD, putting them somewhere HTTP-accessible, and then setting the PictureURL user profile property to the address of this copied image file.

We wanted a sync-all, batch solution — you launch it and it just runs — so we wrote a free tool to help you with this, greatly assisted (thanks again, Robert! :) by a User Profiles Web Part user who had a vested interest in such a tool.

We packaged this up with PeopleZen but you won't even need a license to keep using this free sync tool indefinitely. If you need the source code for more sophisticated customizations, simply contact us and we'll send it to you.

September 25 2010

16:33

Print-Friendly SharePoint Calendar / List Views & User Profiles Web Parts

We recently launched PrintZen, which lets you offer printer-friendly Views of SharePoint List, Calendar and other Web Parts. This article shows you how to integrate PrintZen with PeopleZen to offer print views for your User Profile Web Parts. Once you have both solution packages installed in your SharePoint environment — it's really easy.

August 06 2010

07:00

July 22 2010

14:42
Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.

Don't be the product, buy the product!

Schweinderl