How do we fetch data through WCF Restful/WebAPI service which hosted in azure, from SharePoint online site by using c# coding(httpwebrequest)? Can we need to create app for the SharePoint online which contain rest endpoint or any better solution than this? All the solution I got for Javascript but I need in c# coding as per business requirement like in https://msdn.microsoft.com/en-us/library/office/fp179895.aspx

marked as duplicate by Rob Windsor, Waqas Sarwar MVP, Asad Refai, Robert Lindgren Apr 25 '16 at 5:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


If you're doing calls from SharePoint online, the best way to do it is JavaScript. Making an app for c# means you're creating another azure cloud website that talks to sp and then talks to the rest api. You might as well work in the rest Api directly then

There is one other option, using a sandboxed solution and adding it to the solution gallery. But high chance this feature will dissapear in the future.

EDIT: Now that I think about it, in the previous thread, there was mention of a Web Proxy. I guess this better fits your requirements.

Could you however, explain why exactly that Javascript is not appropriate to use in this case?

  • Hi Christoffel, I want run zzzzzz.sharepoint.com/_api/search/…' KQL query. I have searchquerytool to execute this query at window level , but we need RestAPI service which will be communicated further with biztalk and other... – RajeshSharepointGeek Apr 24 '16 at 11:53
  • So wait, you want Biztalk and other services to do a KQL query through the SharePoint rest service? – Christoffel de Gruyter Apr 24 '16 at 12:04
  • Yes Christoffel, However, I can't shared the managed metadata and other detail of share point with client. So looking for seperate RESPAPI service which hosted in azure cloud and working as interface between biztalk and sharepoint online. Please assist.. – RajeshSharepointGeek Apr 24 '16 at 12:12
  • Can Biztalk to do a KQL query through the SharePoint rest service? – RajeshSharepointGeek Apr 24 '16 at 12:29
  • I don't know anything about Biztalk. But this is a different story, you basically want to do a C# call to SharePoint Online. – Christoffel de Gruyter Apr 24 '16 at 15:58

I'm pretty sure you can't do anything "from SharePoint online site by using c# coding" if you mean that the code will run within SharePoint online. The only way you will be able to use c# coding is from an SharePoint add-in (former app), which per definition is not within the SharePoint site.

  • Hi Jonas, I would like to clarify the requirement 1. Documents are stored in SharePoint online site. 2. Biztalk need restAPI service which will be stored in Azure cloud to execute below query zzzzzz.sharepoint.com/_api/search/…' and return the filter document – RajeshSharepointGeek Apr 24 '16 at 12:07

If you want to do a basic C# call to SharePoint, just follow this: Make a RESTful API Call to SharePoint Online from Console program

Replace the List call with KQL call as described here: https://msdn.microsoft.com/en-us/library/office/jj163876.aspx

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