Can virtual back links be created?

Is it possible to create a virtual attribute on one class of objects and tie it to another attribute via a backlink?

I'm wanting to do something similar to how members and memberof attributes work. You populate members and the memberof attribute is back-linked to it.

I haven't found any references to doing this on any document. I've looked at all the documentation available, the SDK, and have searched the forums without any luck. Only one reference in the search someone stated they did this but didn't specify how.

Any help is really appreciated.

  • I've done something like this before using an onPreGet Event Handler to calculate a value when a Virtual Attribute is requested, then displaying the calculated value.

    This is similar to how Active Roles handles calculated edsa-attributes

    I checked for a script sample, but I wasn't able to find anything relevant immediately. I'll keep looking.

  • This might be a little crude, but it works:

    function onPreGet($Request)
    {
       if($Request.Class -ne "user"){return}
       if($Request.IsAttributeRequested("edsvaCurrentTime"))
       {
        $DirObj.Put("edsvaCurrentTime",(Get-Date).toString())
        $DirObj.SetInfo()
       }
    }

  • This looks like it could work. I need a many to many relationships though. Think members and memberof. Groups can have several objects defined in members and a user for example, has every group they were defined in.

    Having to search every object at time of request sounds like it could be extremely slow. 

    What calls the function? Is it a workflow policy or administrative policy?

  • The example that Terrance provided was for a policy script embedded into a provisioning policy.  And yes, you are right that it would be expensive to process this for more than one user at a time.

    Not sure of your use case, but have you considered an Automation Workflow that could run on a schedule to update these "backlinks" for you periodically?

  • I did but the forward attribute is changing throughout the day. Anyone querying the backlink would be at least 24 hours out of date if it runs nightly. Still wondering what my best course of action will be. 

    The other option was to extend my schema and create a true backlink there. I was trying to avoid that as much as possible and hoping virtual attributes also support this type of linkage.

  • I'm trying to use ADSI searcher to pull a list of object that have a specific DN value in a virtual attribute.

    $DN = $Request.DN
    $SearchRoot = [adsi]::new("EDMS://CN=AD LDS (ADAM)")
    $SearchFilter = "(&(objectclass=customclass)(edsvaACE:1.2.840.113556.1.4.1941:=$DN))"
    $SearchProperties = @('name','distinguishedname','edsvaACE')
    $Resource = [adsisearcher]::new($SearchRoot,$SearchFilter,$SearchProperties)
    $Resource.FindAll()

    This code is not returning any results. If I reduce the filter to just search for the objectclass, I get all the objects but the virtual attribute doesn't load.

    What am I doing wrong here? Can virtual attributes not be searched with ADSI or retrieved?