I am trying to create small application to list the portals configured in a machine/user.
I initialize the Host object:
ArcGIS.Core.Hosting.Host.Initialize();
then I try to use the singleton ArcGISPortalManager, but i keep getting a NullReferenceException
How can i use that object without having to create an Add-in?
neither here:
https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Portal
nor here:
https://pro.arcgis.com/en/pro-app/3.1/sdk/api-reference/topic14684.html
are restrictions or constrains about it.
Solved! Go to Solution.
The CoreHost has access to two namespaces, ArcGIS.CoreHost and ArcGIS.Core, to work with the geodatabase and geometry classes. Therefore, ArcGISPortalManager is unavailable for the CoreHost app.
However, you can call services from the CoreHost by registering a sign-on handler and resolving the credentials using the pattern described in ArcGIS.Core.System.Core.ArcGISSignOn with a complete authentication example illustrated in the ISignOnHandler interface.
The CoreHost has access to two namespaces, ArcGIS.CoreHost and ArcGIS.Core, to work with the geodatabase and geometry classes. Therefore, ArcGISPortalManager is unavailable for the CoreHost app.
However, you can call services from the CoreHost by registering a sign-on handler and resolving the credentials using the pattern described in ArcGIS.Core.System.Core.ArcGISSignOn with a complete authentication example illustrated in the ISignOnHandler interface.