3

I have Custom list where I created a person or group field name -> owner now when I filter according to this field It give me following error.

The expression "Owner/LoginName eq i:0" is not valid.

Same error is shown for field LastName and FirstName.

I hit this api's ->

  1. SharePoint Site URL/_api/web/lists/GetByTitle('customlisttitle')/items?$select=ID,Owner/EMail,Owner/FirstName,Owner/LastName&$filter=Owner/LoginName eq "+encodeURI('i:0#.f|membership|[email protected]')+"&$expand=Owner

  2. SharePoint Site URL/_api/web/lists/GetByTitle('customlisttitle')/items?$select=ID,Owner/EMail,Owner/FirstName,Owner/LastName&$expand=Owner&$filter=Owner/FirstName eq abc

2 Answers 2

4

Can you try the following queries?

/_api/web/lists/GetByTitle('customlisttitle')/items?$select=ID,Owner/EMail,Owner/FirstName,Owner/LastName&$filter=Owner/LoginName eq "+encodeURI('i:0#.f|membership|[email protected]')+"&$expand=Owner/LoginName

/_api/web/lists/GetByTitle('customlisttitle')/items?$select=ID,Owner/EMail,Owner/FirstName,Owner/LastName&$expand=Owner/FirstName &$filter=Owner/FirstName eq 'abc'

Note the expand parameter.

0
0
using react
public emailfilterItemsAsyncFilter= async () => {//6Apr
  let web = new Web(this.props.webUrl);
  var LibName="ListName";
  const headers = {
    Accept: "application/json;odata=nometadata",
    'User-Agent': "NONISV|Microsoft|6491e101-197d-4e60-8084-fc1cd2968bca/2.0",
    'X-ClientTag': "NONISV|Microsoft|6491e101-197d-4e60-8084-fc1cd2968bca/2.0"
  };
  const allItems: any[] = await web.lists.getByTitle(LibName).configure({headers}).items.select("ID","Title","Owner/EMail","Owner/FirstName").expand("Owner").filter("Owner/EMail eq '[email protected]'").top(5000).get();
  return allItems.length;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.