I'm writing code for a notebook that will search for a specific item in my content.
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">getFeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN>layername<SPAN class="punctuation token">,</SPAN> i<SPAN class="operator token">=</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
queryString <SPAN class="operator token">=</SPAN> <SPAN class="string token">'title: '</SPAN> <SPAN class="operator token">+</SPAN> layername <SPAN class="operator token">+</SPAN> <SPAN class="string token">' AND owner: '</SPAN> <SPAN class="operator token">+</SPAN> gis<SPAN class="punctuation token">.</SPAN>properties<SPAN class="punctuation token">.</SPAN>user<SPAN class="punctuation token">.</SPAN>username
<SPAN class="keyword token">print</SPAN> <SPAN class="punctuation token">(</SPAN>queryString<SPAN class="punctuation token">)</SPAN>
layer <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>search<SPAN class="punctuation token">(</SPAN>query <SPAN class="operator token">=</SPAN> queryString<SPAN class="punctuation token">,</SPAN> item_type <SPAN class="operator token">=</SPAN> <SPAN class="string token">'Feature Layer'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">if</SPAN> len<SPAN class="punctuation token">(</SPAN>layer<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">></SPAN> i<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">return</SPAN> layer
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">return</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>import csv
with open('data/users.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
user = gis.users.get(row['username'])
searchlayer = 'WCC_' + row['groupname']
print(searchlayer)
layer = getFeatureLayer(searchlayer)
print(layer)
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>However, this is not returning layers that exist in my content.
WCC_1Testing title: WCC_1Testing AND owner: Ken.Buja_noaa None

I've tried this with other content that I own and it doesn't return the item either.
If I try this with content elsewhere in the organization, it does return layers. Is this because my content that I'm search on hasn't been shared with the organization?