@MehdiPira1 ,
I am one of the admin in the portal so I have access to all the features and layers, I have used these exact lines of code,
layer_items = gis.content.search("*", item_type="Feature Layer", max_items=100)
for item in layer_items:
print(item.layers)
for layer in item.layers or []:
for lyr in layer.properties:
if "WETTBEWERBER" in layer.properties.name.upper():
print(f"Layer name: {layer.properties.name}, \tLayer ID: {layer.properties.id}, \tFeature layer: {item.layers}")
break
The part of the printed results are shown below, the printed resutls are for the print(item.layers) in the third line of the code, even though some have [] empty lists and None, I am not sure, why its like this, so the name condition don't satisfy here. To check the name condition I took of the printed URL and took the name of the layer from the URL that has given the result but only for the esrigeometryPolygon not if I take the layer name of the esrigeometryPoint, Also If I can mention the ID of the feature layer I can get the layer in the result, but I don't know the ID for all the feature layer which has the exact layer, so this is the problem now.
[<FeatureLayer url:"https://maps.com/server/rest/services/MDB2B/FeatureServer/0">]
[<FeatureLayer url:"https://maps.com/server/rest/services/Hosted/Shape_STRAB/FeatureServer/0">]
[<FeatureLayer url:"https://maps.com/server/rest/services/Hosted/MARKTSTAMM_MARKTSTAMM_PUNKT/FeatureServer/0">]
[]
[<FeatureLayer url:"https://maps.com/server/rest/services/Hosted/ShapesOrte2_verbinden/FeatureServer/0">]
[<FeatureLayer url:"https://maps.com/server/rest/services/Hosted/SONDERIMMOBILIEN_INT/FeatureServer/0">]
None
[<FeatureLayer url:"https://maps.com/server/rest/services/Hosted/Marktstamm/FeatureServer/0">]
[<FeatureLayer url:"https://maps.com/server/rest/services/BEFRAGUNGSC/FeatureServer/0">, <FeatureLayer url:"https://maps.com/server/rest/services/BEFUSTER_INT/FeatureServer/1">, <FeatureLayer url:"https://maps.com/server/rest/services/BEFRAGUN/FeatureServer/2">]
[<FeatureLayer url:"https://maps.com/server/rest/services/Hosted/Ortsliste/FeatureServer/0">]
Any other insights will be very helpfull, Thank you so much..