AnsweredAssumed Answered

Search Portal for editable feature layers

Question asked by kenbuja on Dec 13, 2017
Latest reply on Dec 13, 2017 by rscheitlin

Is there a way to search the portal for hosted feature layers that have the "Enabled editing" turned on in the Feature Layer (hosted) Settings? Currently, I'm using code similar to the OAuth sample to search the portal for the feature services that are owned by a user, then I'm looking for a specific layer that contain a phrase (this._baseGridLayerName). Then I create a Feature Layer from the layer URL, but I can't discover if the feature is editable until it's actually loaded

 

var portal = portalUser.portal;
var queryParams = {
  num: 100,
  q: 'owner: ' + this._ownerName + ' AND type: Feature Service'
};
portal.queryItems(queryParams).then(lang.hitch(this, function (result) {
  if (result.total > 0) {
    if (array.some(result.results, lang.hitch(this, function (item) {
      this._SPGridUrl = item.url;
      return this._SPGridUrl.indexOf(this._baseGridLayerName) > -1;
    }))) {
      this._layerSPGrid = new FeatureLayer(this._SPGridUrl + '/0', {
        outFields: ['*'],
        id: 'Priority'
      });

 

Is there a better way of doing this so I don't have to load the feature layer?

Outcomes