Filter documentset folder by contenttype
Hi,
I'm trying to create a lookup field to only show the documentset folders by it's contenttype and not the documents inside the folder. However, it shows me everything. Any idea what i'm doing wrong?
I'm trying to create a lookup field to only show the documentset folders by it's contenttype and not the documents inside the folder. However, it shows me everything. Any idea what i'm doing wrong?
Code: Select all
function (term, page) {
if (! term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10&" +
"$filter = ContentTypeId eq '0x0120D5200097EED96070EB744C944BEB52EF7A3775'";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&" +
"$filter=startswith({LookupField},'" + encodeURIComponent (term) + "') and " +
"ContentTypeId eq '0x0120D5200097EED96070EB744C944BEB52EF7A3775'&$top=10";
}
Hi jacob,
Please, use the following code for this issue:
Please, use the following code for this issue:
Code: Select all
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$filter=startswith(ContentTypeId, '0x0120')&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and startswith(ContentTypeId, '0x0120')&$top=10";
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 10 guests