I am trying to add an item from Enterprise Portal to MapView. I'm trying to add the item, which is a FeatureLayer using its itemID. See code below.
MapView {
id:mapView
anchors.fill: parent
Map {
BasemapDarkGrayCanvasVector{}
initialViewpoint:
ViewpointCenter {
id:viewpoint
targetScale: 1.5e7
Point {
id: initPos
x: -11099972.04
y: 4014041.26
spatialReference: SpatialReference {
wkid: 102100
}
}
}
}
FeatureLayer {
id: structuresInspectionStatusFS
name:"Structures"
visible: true
Component.onCompleted: {
mapView.map.operationalLayers.append(structuresInspectionStatusFS)
}
ServiceFeatureTable {
initItem: inspectionsStatusPortalItem
initLayerId: inspectionsStatusPortalItem.itemId
onLoadStatusChanged: {
}
onLoadErrorChanged: {
console.log(layer.name)
console.log("Error changed:", loadError.message)
}
onErrorChanged: {
console.log(layer.name)
console.log("Error2 changed:", error.message)
}
}
}
PortalItem {
id: inspectionsStatusPortalItem
itemId: //itemID
portal: portalMain
onLoadStatusChanged: {
if (loadStatus === Enums.LoadStatusLoaded){
structuresInspectionStatusFS.item = inspectionsStatusPortalItem
}
}
}
Portal {
id: portalMain
credential: portalCredential
url: "Portal URL"
Component.onCompleted: {
portalMain.load();
}
onLoadStatusChanged: {
if (portalMain.loadStatus === Enums.LoadStatusLoaded) {
inspectionsStatusPortalItem.load()
} else {
}
}
}
Credential {
id:portalCredential
username: "username"
password: "password"
}
Connections {
target: AuthenticationManager
onAuthenticationChallenge: {
if (challenge.authenticationChallengeType === Enums.AuthenticationChallengeTypeUsernamePassword) {
challenge.continueWithCredential(portalCredential);
}
}
}
}
This used to work in AppStudio 4 and its Runtime, but now that I've upgraded to AppStudio 5 and latest Runtime, it doesn't work anymore. I get an "Invalid Argument" Error from the error signals on ServiceFeatureTable.
I know it's not an authentication issue, because I have other FeatureLayers that I'm adding to the map and they work fine. The difference is that those FeatureLayer items don't get added as PortalItem.
Any help is appreciated!
--------------------------------------------------
Application Developer, GeoMarvel