Hi, Could you show the whole workflow to save FeatureCollection to Portal ?
Hi Yan,
I have used one of the existing sample, "FeatureCollectionLayerFromQuery", modified it to save the created feature collection from the feature layer (Layer: Wildfire Response Points (ID: 0) ) to the portal. Before using FeatureCollection.SaveAsAsync() method, you need to log in to the portal as below. Attached is the complete project. Once the code is executed, you will see a new item named, "Feature Collection to Portal" is added in the portal that copies all the features from the feature layer.
var tokenServiceUri = new Uri("https://www.arcgis.com/sharing/rest"); // url for generating token
AuthenticationManager authManager = AuthenticationManager.Current;
 var cred = await authManager.GenerateCredentialAsync(tokenServiceUri, "<portal_user_name>", "<portal_password>");
// Open a portal item containing a feature collection
 ArcGISPortal portal = await ArcGISPortal.CreateAsync(tokenServiceUri, cred);
FeatureCollectionLayer featCollectionTable = new FeatureCollectionLayer(featCollection);
 await featCollectionTable.LoadAsync();
 MyMapView.Map.OperationalLayers.Add(featCollectionTable);
List<string> str = new List<string>();
 str.Add("Save Feature collection");
try
 {
 await featCollection.SaveAsAsync(portal, null, "Feature Collection to Portal", "FeatureCollection", str);
 MessageBox.Show("Feature Collection saved to portal");
 }
catch(Exception ex)
 {
 MessageBox.Show(ex.Message);
 }
Hope that helps.
Nagma
Thanks, Nagma