ArcGISPortalManager can be used in a console application?

172
1
04-16-2024 04:29 AM
Cristian_Galindo
Occasional Contributor III

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.

Tags (2)
0 Kudos
1 Reply
Aashis
by Esri Contributor
Esri Contributor

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. 

0 Kudos