nerdexam
Microsoft

70-489 · Question #11

You develop a SharePoint app for a toy company that uses the Representational State Transfer (REST} API for search. The site collections in the app have been crawled recently and use the default…

The correct answer is D. var resultSourceId = "82951A0C-6385-4E29-8D7F-4AB92FE9F536". This question tests knowledge of referencing a custom SharePoint result source by its GUID in a REST search query to filter results to PDF documents only.

Plan and implement a search solution

Question

You develop a SharePoint app for a toy company that uses the Representational State Transfer (REST} API for search. The site collections in the app have been crawled recently and use the default search schema. The app includes the following code segment: (Line numbers are included for reference only.) You create the following result sources. You need to ensure that the app only displays PDF documents. Which code segment should you insert at line 03?

Exhibits

70-489 question #11 exhibit 1
70-489 question #11 exhibit 2

Options

  • Avar resultSourceId = "Site PDF";
  • Bvar resuitSourceId = "4C50FE18-B254-47A1-ABAD-0B6C4577D914";
  • Cvar resultSourceId = "0F41A999-523A-41ED-AAAD-9D414A0FC3B4";
  • Dvar resultSourceId = "82951A0C-6385-4E29-8D7F-4AB92FE9F536";

How the community answered

(40 responses)
  • A
    35% (14)
  • B
    8% (3)
  • C
    13% (5)
  • D
    45% (18)

Why each option

This question tests knowledge of referencing a custom SharePoint result source by its GUID in a REST search query to filter results to PDF documents only.

Avar resultSourceId = "Site PDF";

Result sources must be referenced by their GUID in the REST API; using a display name string like 'Site PDF' is not a valid value for resultSourceId and will not resolve to any result source.

Bvar resuitSourceId = "4C50FE18-B254-47A1-ABAD-0B6C4577D914";

The GUID '4C50FE18-B254-47A1-ABAD-0B6C4577D914' corresponds to a different result source and would return results scoped to that source rather than PDF documents.

Cvar resultSourceId = "0F41A999-523A-41ED-AAAD-9D414A0FC3B4";

The GUID '0F41A999-523A-41ED-AAAD-9D414A0FC3B4' corresponds to a different result source and would not filter results to PDF documents as required.

Dvar resultSourceId = "82951A0C-6385-4E29-8D7F-4AB92FE9F536";Correct

The GUID '82951A0C-6385-4E29-8D7F-4AB92FE9F536' is the identifier assigned to the 'Site PDF' result source created in the app. When assigned to resultSourceId in the REST query, SharePoint scopes the search results to only documents matching that result source's query transform, which targets PDF files. Using the correct GUID ensures the REST API applies the right content filter at query time.

Concept tested: SharePoint Search REST API result source GUID filtering

Source: https://learn.microsoft.com/en-us/sharepoint/dev/general-development/query-refinement-in-sharepoint

Topics

#REST API#search result sources#file type filter#result source GUID

Community Discussion

No community discussion yet for this question.

Full 70-489 Practice