I need to list all PITrusts of a PIServer within a .NET-Application. Is it possible by using the TrustCollection class of OSIsoft.PI.Net.dll? Is there a source code example?
We don't recommend using OSIsoft.PI.Net.dll on your projects since it is internal library which is used by our PI Developer Technologies such as PI AF SDK. As a result, there is no documentation available and we cannot support any of your questions concerning its use.
If you want to have access to PI trusts, you can:
Hope this helps!
Adding to the good advice from Marcos, you may also want to take a peek at these AF SDK methods:
Unfortunately it seems, that the classes in the namespace OSIsoft.AF.PI do not provide any methods to access the PITrust table. So I asked about the OSIsoft.PI.Net.dll.
PI Trusts are not as secure as PI Mappings, and we encourage all users to migrate to using PI Mappings for all authentication purposes. Hence the AFSDK does not provide programmatic access to the PI Trusts table.
Unfortunately, that does present some difficulty in trying to access PI Trusts from .NET/AFSDK. As Marcos suggested, the PowerShell Tools for PI is a good option. As long as your client machine has PowerShell v2.0+, it should be relatively easy to call PowerShell.Invoke from your .NET application to get the PI Trusts from the server. It's not quite as clean or easy as referencing a method from a library, but hopefully it's pretty close.
Retrieving data ...