Graph API - use $search with multiple parameters

Donald Kim 1 Reputation point
2021-03-04T09:47:12.47+00:00

Hello!

I want to use $search (https://learn.microsoft.com/en-us/graph/query-parameters#search-parameter) with multiple parameters with OR statement, like this:

https://graph.microsoft.com/v1.0/me/messages?$search="hello" or "good day"

But I can't find something helpful in documentation.

May be there is some way to use this with OR statement?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,710 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Dev 111 Reputation points
    2021-03-31T11:31:35.67+00:00

    You can pass the OR statement between the condition followed with the "statement1" OR "statement2 and make sure you have space between statement1<space>OR<space>statement2"

    For my case below is the sample that worked.

    https://graph.microsoft.com/beta/users?$search=%22jobTitle:u%22%20OR%20%22displayName:u%22

    For your case below should work

    https://graph.microsoft.com/v1.0/me/messages?$search="hello" OR "good day"

    Note : OR should be in capital.
    Thanks

    0 comments No comments

  2. Danstan Onyango 3,741 Reputation points Microsoft Employee
    2021-07-07T07:49:20.783+00:00

    For this kind of search, you should use the search API. Here is a example to search your files.

    POST https://graph.microsoft.com/v1.0/search/query  
          
    {  
        "requests": [  
            {  
                "entityTypes": [  
                    "message"  
                ],  
                "query": {  
                    "queryString": "hello OR good day"  
                }  
            }  
        ]  
    }  
    

  3. 2023-06-21T09:19:03.83+00:00

    يعرض تقرير الأداء البيانات الحديثة التي مرّ عليها أقل من يوم. أصبح بإمكانك الآن الوصول إلى هذه البيانات من خلال واجهة برمجة التطبيقات عن طريق تمرير معلَمة الطلب dataState مع ضبط القيمة على all. ستتضمّن البيانات التي تحصل عليها لهذه القيمة أيضًا بيانات حديثة ليست نهائية بعد. إذا أردت الحصول على البيانات النهائية فقط، يمكنك إما تمرير هذه المعلَمة مع ضبط القيمة على final أو عدم تمريرها على الإطلاق، وستحصل على البيانات النهائية فقط بشكل تلقائي.

    قبل بضعة أشهر، أضفنا علامة التبويب "الأخبار" في فلتر البحث إلى تقرير الأداء. تتوفر هذه المعلومات الآن أيضًا في واجهة برمجة التطبيقات، ويمكنك الوصول إليها من خلال ضبط قيمة معلَمة searchType في الطلب على news.

    0 comments No comments