Select to view content in your preferred language

Issue querying users items - Specfically Folders

358
0
02-06-2023 08:04 AM
AndrewMurdoch1
Occasional Contributor II

Good Day

I have the following function which is running query by username to get the folders that a user has access to.  This function worked a couple of weeks ago, and would return me the list, and now it's running nothing. 

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);
		})
	})
}

 

1. Is this the right way to query for folders? 
2. What would prevent this query from returning the folders

Thanks

0 Kudos
0 Replies