ArcGISPortalManager can be used in a console application?

138
1
2 weeks ago
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