1

Is this possible? We have an intranet hosted in Office 365 using SharePoint Online, however the performance is not that great. I wanted to migrate it to on-prem however for some of the functionality we use javascript, the search API, and Delve to get profile properties and pictures.

Whenever I bring the script on-prem and try to perform a staff search I get a 403 error when our on-prem domain tries to perform a search API GET against SharePoint Online using the below URL:

GET https://my-company.sharepoint.com/_api/search/query(querytext='bruce',%20rowlimit='500',%20trimduplicates=true,%20sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31',%20selectproperties='AccountName,PreferredName,JobTitle,Department') 403 ()

The ajax query params are really simple:

$.ajax({
      url: "https://my-company.sharepoint.com/_api/search/query(" + str  + ")",
      type: 'GET',
      headers: {
        'accept': 'application/json;odata=verbose'
      }

Is there any way to make this work?

2

[Edit]: CORS is happening here... You wont be able to access SPO from your onprem... Sorry

Aanother approach could be to connect your O365 search to your local farm in a hybrid scenario by consuming their index. That would allow you to access the information as if they would be hosted on your search service. This wont work for delve access thought, since that's only available online.

  • Hm, we already are in a hybrid setup, so why doesn't it work? We have a cloud search service application that crawls our local content and pushes it to the cloud index regularly and also have the hybrid onedrive features setup. – Christopher Bruce Mar 27 '18 at 17:36
  • Ah, just saw your edit, damn... – Christopher Bruce Mar 27 '18 at 17:38
  • 1
    Updated my comment... The JS has issues with CORS... Your hybrid setup needs to be 2 way for the query against the remote server. – Heiko Hatzfeld_MSFT Mar 27 '18 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.