Sunday, April 11, 2010

XPath in FIM Sets

Recently, while working with Brad on a FIM implementation, he told me about some issues he was having with the restrictions placed on the XPath used when building a new Set. Specifically, he wanted to be able to find people that were missing a specific attribute. This was a little tricky, but I finally came up with a solution for strings and another one for dates:

/Person[not(starts-with(<AttributeNameOfTypeString>, ''))]
/Person[not(<AttributeNameOfTypeDateTime> &gt; '1900-01-01T00:00:00Z')]

So, if you wanted to find everyone who was missing an AD Distinguished Name (ADDN) you would use the following filter to define the Set:

/Person[not(starts-with(ADDN, ''))]
And if you wanted all of the Person objects missing a Termination Date (EmployeeEndDate):
/Person[not(EmployeeEndDate &gt; '1900-01-01T00:00:00Z')]

These examples are specific for the Person resource object, but this same logic could be used for any resource type in the FIM Portal.

UPDATE:  In certain instances, the above XPath will actually return more items than you would expect.  Check out David’s blog post to find out why and what really works.