Good Day
I posted a similar question under the ArcGIS REST JS section. I'm running a query by username to try and fetch the folders that are under a user account, where is the function:
private getArcGISFolders(): Promise<ArcGISItem[] | Error>{
return new Promise((r, j) => {
const query = new PortalQueryParams({
query: `username: ${this._portal.user.username}`,
});
this._portal.queryUsers(query).then((queryResults) => {
this._folders = [];
if (!Array.isArray(queryResults.results)) {
j();
} else {
try {
queryResults.results?.forEach((folder) => {
console.log('Folder');
console.log(folder);
this._folders.push({
id: folder.id,
title: folder.title
})
})
} catch(error) {
j(error);
}
}
r(this._folders);
}).catch((error) => {
console.log('Query User - Error');
console.log(error);
j(error);
})
})
}
A couple of weeks ago this function was working fine, and I was getting the folders that a user had under their ArcGIS Account, and now I'm not. I noticed in the response that "access" is set to "public", which I think is what is causing the problem.
1. Is there a way to properly modify the access of the queryUser function?
2. Is this the right way to query for folders from ArcGIS?
Thanks
HI there,
Your code looks similar to the code snippet found here: https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#queryUsers. But the code snippet calls fetchFolders. Can you update your code to call fetchFolders as shown in the code snippet?
I ended up doing a manual rest call, but why would the cost work without that call and then suddenly break? Now it's working fine, so I don't want to make any more changes to it.