2

I am doing Salesforce integration with SharePoint using OAuth 'client_credential' method. I am able to fetch file content and but unable to render that content as a word or pdf.or image file. Is there any URL which I can hit and it download file automatically in the browser.

HttpRequest reqWrite = new HttpRequest();
        Http httpWrite = new Http();
        endpoint = 'xxx.com/sites/dpmqa/_api/web/GetFileByServerRelativeUrl(\'/sites/xxx/Records/xxx/xxx.docx\')/$value';reqWrite.setEndpoint(endPoint);
        reqWrite.setMethod('GET');
        reqWrite.setHeader('Accept', 'application/json;odata=verbose');reqWrite.setHeader('Authorization','Bearer '+ accessToken);HttpResponse resWrite = new HttpResponse();         
        try{ 
            resWrite = httpWrite.send(reqWrite);
Mohamed El-Qassas MVP
  • 45,382
  • 9
  • 53
  • 96
gangparia
  • 21
  • 1
  • 1
    Can you post your current code here? How are you making REST call to retrieve the file? – Atish Kumar Dipongkor Aug 08 '17 at 09:00
  • HttpRequest reqWrite = new HttpRequest(); Http httpWrite = new Http(); endpoint = 'xxx.com/sites/dpmqa/_api/web/GetFileByServerRelativeUrl('/sites/xxx/Records/xxx/xxx.docx')/$value';reqWrite.setEndpoint(endPoint); reqWrite.setMethod('GET'); reqWrite.setHeader('Accept', 'application/json;odata=verbose');reqWrite.setHeader('Authorization','Bearer '+ accessToken);HttpResponse resWrite = new HttpResponse();
    try{ resWrite = httpWrite.send(reqWrite);
    – gangparia Aug 08 '17 at 11:03

0 Answers0