AnsweredAssumed Answered


Question asked by Arco on Feb 18, 2016
Latest reply on Mar 31, 2016 by cmanhard

Hi All,


could somebody explain to me how setting the obsolete date of an AFElement works?

I have this model with AFElements and I want these AFElements to "remove" themselves when a certain time has passed, so the model will not grow indefinitely in time.

And there is no need to keep these AFElements indefinitely.

So I tried setting the ObsoleteDate via the AFSDK like this:


AFElementTemplate afElementTemplate = myAFDatabase.ElementTemplates["CorrectionTmpl"];

AFElement createdElement = block.BlockAFElement.Elements.Add("Correction*", afElementTemplate);



But what happens is, that the item is removed immediately.

When I set the ObsoleteDate 180 days in the future on an AFElement directly on the model via the AFExplorer, the same happens.

The AFElement is removed instantly.


From the AFSDK Help file:

AFVersion.  SetObsoleteDate Method

The date that the owning object became obsolete. The obsoleteDate cannot be before or equal to the EffectiveDate. Passing AFTime.MaxValue will remove the obsolete date from the object so that it is no longer considered obsolete.


So there is a relation to the EffectiveDate, but I see the elements I create without the SetObsoleteDate have an EffectiveDate of Now, so that should be ok.


Any help is appreciated.


PI System 2015 R2 SP1

AFServer Version