POST
|
Ok I was eventually able to figure this out through a lot of trial and error as the docs don't really lay this whole thing out too well. I had the user id and wanted to get the first and last name for that user. Your query string for the PortalQueryParameters just needs to be the user id. There really isn't a query you need to form here if it's that simple. You then get a user back and you can hit the FullName property from there. Thanks for pointing me in the right direction Joe. Appreciate it ... PortalQueryParameters userParams = new PortalQueryParameters(<User ID>); PortalQueryResultSet<PortalUser> users = await Portal.FindUsersAsync(userParams); string fullname = users.Results.ElementAt(0).FullName;
... View more
10-09-2019
11:34 AM
|
0
|
0
|
459
|
POST
|
I am writing a tool that allows one user to share content created offline with other users. Here's how it currently works: User consumes feature service shared with them through a portal group and creates an offline geodatabase User created new content within that offline geodatabase User wants to share that content with other users who also have access to that same feature service Pseudo Code is as follows: I get a list of all groups in the Portal with which that feature service has been shared I then cursor through all the collections of Admins, Members, and Users for each of those groups creating a master list of users that are eligible for sharing All of those properties kick back the portal user id as a string What I want to do is get the first and last name of each portal user to display in a list. To do that I need to get a PortalUser object and I haven't found the combination of calls to make that happen. I headed down this direction: PortalQueryParameters gParams = PortalQueryParameters.CreateForItemsWithId(portalItem.ItemId); PortalQueryResultSet<PortalUser> pUsers = await ApplicationManager.SessionManager.Portal.FindUsersAsync(gParams); The portal item is the feature service and I figured this would give me all the PortalUser objects that had access to it, but it comes back with nothing. I tried a couple of different but similar calls and none return any PortalUsers. Anyone have any ideas on this? Thanks in advance for your help ...
... View more
10-03-2019
07:13 AM
|
0
|
2
|
529
|
POST
|
Thanks for the feedback Michael. We are still using ArcMap MXDs as our source for feature services. We have customers that do not have portals federated with ArcGIS Server so we need to support publishing directly to ArcGIS Server for our customers who do not have that architecture. Lowest common denominator type of thing. We are also not generating mobile map packages from our feature services - just SQLites. So I think I'm out of luck on this for now then ...
... View more
05-23-2019
02:20 PM
|
0
|
0
|
672
|
POST
|
I've got a point feature layer that I've added to the map from an offline SQLite geodatabase generated from a feature service. I've set up labeling on the layer with the placement properties set to use the value from a rotation field to rotate the text. The points are rotating fine from that same field, but the point labels stay horizontal. Is this something 100.5 API does not support or am I missing something here?
... View more
05-22-2019
04:12 PM
|
0
|
2
|
850
|
POST
|
We had a little breakthrough late yesterday. We are now using straight REST API calls to get the token against the feature service and then applying that token to an ArcGISTokenCredential object. We can supply that object to the geodatabase create and sync calls. Seems like a franken-solution, but it's working so we're going with it for now. There has to be a way to accomplish all this through the Runtime API, but we weren't able to put all the puzzle pieces together correctly for an IWA portal. Thanks for all your input though Joe.
... View more
03-29-2019
08:51 AM
|
0
|
0
|
305
|
POST
|
Hey Joe. So I am now able to get a token successfully in a WPF app, but continually get 401 errors with the same code in a Xamarin Forms app. I feel like there is a small piece of the puzzle missing on the Forms side. I believe you are right in saying it is not a Portal issue. I'm wondering if it is something at the IIS level since the creds are passed through automatically in Windows and not in iOS or Android. We've played around with a few settings and have had no luck so far. We also have a Esri support ticket opened on this.
... View more
03-28-2019
11:49 AM
|
0
|
2
|
305
|
POST
|
I just tried that Joe and it worked fine. Took my windows credentials and logged me in.
... View more
03-20-2019
12:04 PM
|
0
|
4
|
1871
|
POST
|
Hey Joe thanks for the reply. I went ahead and tried the brute force approach and tried to generate a TokenCredential object from my user credentials right before generating an offline geodatabase from the feature service. More or less doing it the same way you are, and I am currently getting a 401 error on that which is really strange. We are now working with our network dude to see if something is wrong outside of our Portal implementation.
... View more
03-18-2019
03:17 PM
|
0
|
6
|
1871
|
POST
|
That's a little tough as we've got pieces of all this all over the place, but I'll get you the basics here in no specific order. What I was after with this post was a recipe. There has to be a set of steps that has to be taken to log into an IWA portal and be able to make requests against feature services in that portal. It seems like the ArcGISNetworkCredential gets me in the front door, but doesn't allow me to drink any beers in the fridge if you know what I mean. AuthenticationManager.Current.ChallengeHandler = new IwaChallengeHandler { AllowSaveCredentials = saveCredentials };
await CreateIwaCredentialAsync(new CredentialRequestInfo
{
ServiceUri = new Uri(_serviceUri),
AuthenticationType = AuthenticationType.NetworkCredential
});
ArcGISNetworkCredential credential = await
AuthenticationManager.Current.ChallengeHandler.CreateCredentialAsync(credRequestInfo)
as ArcGISNetworkCredential;
if (credRequestInfo.Response == null)
AuthenticationManager.Current.AddCredential(credential);
using EFCloud.Events;
using EFCloud.Security.Managers;
using EFCloud.ViewModels;
using EFCloud.Views;
using Esri.ArcGISRuntime.Security;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace EFCloud.Security.Handlers
{
internal class IwaChallengeHandler : IChallengeHandler
{
#region Variable/property declaration
private bool _allowSaveCredentials;
private bool _areCredentialsRestored;
private LoginPage _loginPage = new LoginPage();
// A TaskCompletionSource to store the result of a login task.
private TaskCompletionSource<Credential> _loginTaskCompletionSrc;
public bool AllowSaveCredentials
{
// The first time AllowSaveCredentials is set to true, the cached credentials are added to the AuthenticationManager
// The default value is false
get { return _allowSaveCredentials; }
set
{
if (_allowSaveCredentials != value)
{
_allowSaveCredentials = value;
if (_allowSaveCredentials && !_areCredentialsRestored)
{
// The first time AllowSaveCredentials is set to true, add the cached credentials to AuthenticationManager
_areCredentialsRestored = true;
foreach (var crd in RetrieveAllSavedCredentials())
{
AuthenticationManager.Current.AddCredential(crd);
}
}
}
}
}
#endregion
#region Constructor and Initialize
public IwaChallengeHandler()
{
Initialize();
}
private void Initialize()
{
// Set up event handlers for when the user completes the login entry or cancels
LoginPageViewModel loginPageViewModel = _loginPage.BindingContext as LoginPageViewModel;
loginPageViewModel.OnLoginInfoEntered += LoginInfoEntered;
loginPageViewModel.OnCanceled += LoginCanceled;
}
#endregion
/// <summary>
/// Retrieves all EpochField credentials
/// </summary>
/// <returns>IEnumerable<Credential></returns>
internal IEnumerable<Credential> RetrieveAllSavedCredentials()
{
return CredentialManager.RetrieveAll();
}
public async Task<Credential> CreateCredentialAsync(CredentialRequestInfo info)
{
// Ignore challenges for OAuth (might come from secured layers in public web maps, for example).
if (info.AuthenticationType != AuthenticationType.NetworkCredential)
{
Console.WriteLine("Authentication for " + info.ServiceUri.Host + " skipped.");
return null;
}
// Return if authentication is already in process
if (_loginTaskCompletionSrc != null && !_loginTaskCompletionSrc.Task.IsCanceled)
{
return null;
}
// Create a new TaskCompletionSource for the login operation
// (passing the CredentialRequestInfo object to the constructor will make it available from its AsyncState property)
_loginTaskCompletionSrc = new TaskCompletionSource<Credential>(info);
// Show the login controls on the UI thread
// OnLoginInfoEntered event will return the values entered (username, password, and domain)
ArcGISNetworkCredential iwaCred = AuthenticationManager.Current.FindCredential(info.ServiceUri, AuthenticationType.NetworkCredential) as ArcGISNetworkCredential;
if (iwaCred != null)
{
_loginTaskCompletionSrc.TrySetResult(iwaCred);
}
else
{
Device.BeginInvokeOnMainThread(async () => await App.Current.MainPage.Navigation.PushAsync(_loginPage));
}
// Return the login task, the result will be ready when completed (user provides login info and clicks the "Login" button)
return await _loginTaskCompletionSrc.Task;
}
#region Event Handlers
// Handle the OnLoginEntered event from the login UI
// LoginEventArgs contains the username, password, and domain that were entered
private void LoginInfoEntered(object sender, LoginDialogEventArgs e)
{
// Make sure the task completion source has all the information needed
if (_loginTaskCompletionSrc == null ||
_loginTaskCompletionSrc.Task == null ||
_loginTaskCompletionSrc.Task.AsyncState == null)
{
return;
}
try
{
// Get the associated CredentialRequestInfo (will need the URI of the service being accessed)
CredentialRequestInfo requestInfo = _loginTaskCompletionSrc.Task.AsyncState as CredentialRequestInfo;
// Create a new network credential using the values entered by the user
var networkCredential = new System.Net.NetworkCredential(e.Username, e.Password, e.Domain);
// Create a new ArcGIS network credential to hold the network credential and service URI
var arcgisCredential = new ArcGISNetworkCredential
{
Credentials = networkCredential,
ServiceUri = requestInfo.ServiceUri
};
if (AllowSaveCredentials)
{
CredentialManager.AddCredential(arcgisCredential);
}
// Set the task completion source result with the ArcGIS network credential
// AuthenticationManager is waiting for this result and will add it to its Credentials collection
_loginTaskCompletionSrc.TrySetResult(arcgisCredential);
}
catch (Exception ex)
{
// Unable to create credential, set the exception on the task completion source
_loginTaskCompletionSrc.TrySetException(ex);
}
finally
{
// Dismiss the login controls
App.Current.MainPage.Navigation.PopAsync();
}
}
private void LoginCanceled(object sender, EventArgs e)
{
// Dismiss the login controls
App.Current.MainPage.Navigation.PopAsync();
// Cancel the task completion source task
_loginTaskCompletionSrc.TrySetCanceled();
}
#endregion
public void Reset()
{
_loginTaskCompletionSrc = null;
}
}
}
... View more
03-14-2019
05:30 PM
|
0
|
8
|
1871
|
POST
|
We pop up a homegrown login page for the user to enter their creds. That works fine. My issue is with accessing a feature service on our portal and making a request to that service. It is complaining about a token when I make that request to the service.
... View more
03-14-2019
03:07 PM
|
0
|
1
|
1871
|
POST
|
We've got an IWA Portal setup in house and we are working on getting our iOS Runtime Xamarin Forms application to work properly with it. We have been using oAuth based authentication for years and now have customers implementing IWA based Portals and need to support that. To get the login going I am using the ArcGISNetworkCredential. When the authentication challenge is issued against our IWA portal we pop up a home grown username/password form, take that information, create the ArcGISNetworkCredential and login to the portal accordingly. I've got that all working well. We have a couple of tools that utilize feature services to create offline geodatabases to support field work. When I try to generate those offline geodatabases using the ArcGISNetworkCredential I am getting an error that a token is required. Makes sense. Problem is the ArcGISNetworkCredential does not have a token associated with it. I then switched gears and attempted to use the ArcGISTokenCredential for everything - logging into the portal and generating geodatabases from feature services. No luck there - could not get that to work for logging in. I've been through the multitude of online documents referring to integrated windows authentication implementation and have used a lot of code examples in there within our app. I have not found anything that addresses our particular scenario though. I feel like I'm close on this and am missing a small piece of the puzzle. Can someone point me in the right direction? Thanks!
... View more
03-14-2019
11:26 AM
|
0
|
12
|
2699
|
POST
|
I've got a Xamarin Forms application with some GPS functionality that has been working great for years. Since we've upgraded to 100.4 our GPS functionality is not working on Android. Still works great on iOS though. Basically as soon as we set the IsEnabled property on the MapView.LocationDisplay to true it immediately resets itself to false. We've tested this on two different Android devices, one with 6.0.1, and one with 7.1.1. Doesn't work on either. I've attached a repro solution here.
... View more
12-13-2018
10:25 AM
|
0
|
2
|
1127
|
POST
|
I'm writing some code that is attempting to modify the geometry of an existing polygon feature, let's call it the parent, based on the extent of all of its children (collection of lines, points, or the combination of the two). The parent/child relationship is just that, a relationship between two feature classes, but the extent of the parent needs to fully contain all the children. The children of the parent are selected from the map. The first time this happens the parent geometry is null because there are no children yet. I select a bunch of lines and it creates the parent geometry correctly. If I attempt to add more children lines by selecting other features from the map it appears to update/expand the parent geometry correctly in that session. I can draw a graphic for that new geometry on the screen and it appears as it should. I then close my application, log back in, and take a look at that parent geometry again and it is back to what it originally was after the first selection set was processed. So it seems like it can update a polygon geometry if it is null to start with, but if there is already an existing polygon geometry it doesn't update it. I don't get any errors during the update call though, so on the surface everything seems ok. I update geometries for points in a similar manner and that works fine. Am I missing something here or does updating polygon geometries work differently? Here is the code I am using to update the polygon geometry. This occurs after the selection of point/line features in the map (AdHocWorkFeatureList). I feel like this is some sort of red herring, but haven't been able to figure it out yet. Hopefully some more eyes on it will help. Thanks ... List<Feature> workFeatures = new List<Feature>(); DateTime snapshotDateTimeNow = DateTime.Now; if (!m_SelectedWorkDownloadAreaGeodatabase.IsInTransaction) m_SelectedWorkDownloadAreaGeodatabase.BeginTransaction(); // ADD ALL SELECTED MAP FEATURES TO A LIST foreach (AdhocWorkFeature adhocWorkFeature in AdhocWorkFeatureList.Where(x => x.IsChecked)) { Feature aFeature = null; switch (adhocWorkFeature.Geometry.GeometryType) { case GeometryType.Point: aFeature = await AddWorkOrderPointForAdhocWorkOrderFeature(adhocWorkFeature, snapshotDateTimeNow); workFeatures.Add(aFeature); break; case GeometryType.Polyline: aFeature = await AddWorkOrderLineForAdhocWorkOrderFeature(adhocWorkFeature, snapshotDateTimeNow); workFeatures.Add(aFeature); break; } } // UNION EXTENTS OF ALL SELECTED MAP FEATURES Geometry newGeometry = GeometryEngine.Union(workFeatures.Select(f => f.Geometry.Extent)); Geometry newWorkOrderGeom = newGeometry; // IF PARENT GEOMETRY IS NOT NULL UNION PARENT GEOMETRY WITH UNION OF ALL SELECTED MAP FEATURES if (SelectedWorkOrder.Geometry != null) { newWorkOrderGeom = GeometryEngine.Union(newGeometry, SelectedWorkOrder.Geometry); } // BUFFER NEW PARENT EXTENT Geometry bufferedGeometry = GeometryEngine.Buffer(newWorkOrderGeom.Extent, ApplicationManager.ConfigManager.WorkManagementToolSettings.AdhocWorkOrderBufferInMeters); // ADD GRAPHIC TO MAP TO CHECK NEW EXTENT Graphic gr = new Graphic(bufferedGeometry); gr.Symbol = EpochUtils.GetPolygonHighlightSymbol(); m_WorkManagementToolAdHocWorkFeaturesGraphicsLayer.Graphics.Add(gr); // UPDATE GEOMETRY PROPERTIES FOR IN MEMORY PARENT SelectedWorkOrder.Geometry = bufferedGeometry; SelectedWorkOrder.GeodatabaseFeature.Geometry = bufferedGeometry; // GET FEATURE TABLE TO UPDATE GeodatabaseFeatureTable workOrderFeatureTable = (GeodatabaseFeatureTable)SelectedWorkOrder.GeodatabaseFeature.FeatureTable; // GET FEATURE TO UPDATE string whereClause = "GLOBALID = '{" + SelectedWorkOrder.GlobalId.ToString().ToUpper() + "}'"; FeatureQueryResult fqr = await m_LocalGDBStallion.QueryFeatureTable(workOrderFeatureTable, whereClause); Feature actualFeature = fqr.ElementAt(0); // SET FEATURE GEOMETRY TO BUFFERED GEOMETRY AND UPDATE FEATURE actualFeature.Geometry = bufferedGeometry; await workOrderFeatureTable.UpdateFeatureAsync(actualFeature); // THIS RETURNS 1, SO UPDATE HAS OCCURRED FeatureQueryResult fqrUpdate = await workOrderFeatureTable.GetUpdatedFeaturesAsync(); // COMMIT TRANSACTION if (m_SelectedWorkDownloadAreaGeodatabase.IsInTransaction) m_SelectedWorkDownloadAreaGeodatabase.CommitTransaction();
... View more
10-18-2018
07:57 AM
|
0
|
0
|
466
|
POST
|
Ok that's good to know Jennifer. So I assume this will be fixed in 100.4 then? No I am not trying to update the geometry before it has been completed. The scenario I described is where the completed "event" doesn't occur consistently unless I pause before I lift my finger off the screen on a drag and drop.
... View more
08-24-2018
07:36 AM
|
0
|
0
|
630
|
Title | Kudos | Posted |
---|---|---|
1 | 04-09-2015 03:51 PM | |
1 | 03-06-2018 11:55 AM | |
1 | 01-18-2017 04:10 PM | |
1 | 01-09-2016 05:17 PM | |
1 | 06-08-2017 06:52 AM |
Online Status |
Offline
|
Date Last Visited |
12-28-2020
01:52 PM
|