Search code examples
c#podio

How to FilterItems by Contains


I can collect items if I have the exact string of a text field but I need to collect items if I have a partial string in a text field.

Here is the code that I have for exact match...

public static async Task<int> Items_With_String(int appId, string textFieldId, string stringToSearch)
{

    var filter = new Dictionary<string, string>
    {
        {textFieldId, stringToSearch }
    };

    var filteredItems = await Program.podio.ItemService.FilterItems(appId: appId, filters: filter);

    foreach (var item in filteredItems.Items)
    {
        Console.WriteLine($"{stringToSearch} found in {item.Title}");
    }

    return filteredItems.Total;
}

Solution

  • Instead of FilterItems, you can use Search functionality.

    you can refer below link for more info.

    https://developers.podio.com/doc/search/search-in-app-4234651

    please see the sample

                    bool isContinue = true;
                    var limit = 0;
                    var offSet = 0;
                    while (isContinue)
                    {
                        var items = podio.SearchService.SearchInApp(appId, stringToSearch, limit, offset);
                        offSet = offSet + limit;
                        limit = limit + 100;
                        isContinue = // check if you have value;
                    }