-
Getting trouble to send document to google drive File/Folder in Salesforce
Hi,
My requirement, I have Visualforce page where
1- I can attach a document and send to my google drive.
2- I can get all the folder from the google drive and show in VF page.
1st one I did successfully but in case of the 2nd point I am getting 'Forbidden' error.
Something I missed please guide me-
http objHttp = new http();
Google_Auth_Detail__c tmpGD = [select id,Access_Token__c,Authorization_Code__c,Client_Id__c,Secret_Code__c,Expire_In__c,Refresh_Token__c,Scope__c,Token_Type__c from Google_Auth_Detail__c limit 1];
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('GET');
//req.setEndpoint('https://www.googleapis.com/drive/v2/files');
req.setEndpoint('https://www.googleapis.com/drive/v3/files/0B_QE5jslfxO6clpiRWRnOXpFR00?alt=media');
req.setHeader('Authorization',tmpGD.Access_Token__c );
//HttpResponse resp = http.send(req);
HttpResponse res;
res = objHttp.send(req);
system.debug(res.getStatusCode()+'......'+res.getStatus()+'....res.........'+res.getBody());This is my method to get from google drive.
Log In to reply.
Popular Salesforce Blogs

Salesforce Boosts its Marketing Cloud with Partnership with AI and Google
The Salesforce CRM is extremely customizable by design. A Salesforce development company provides CRM solutions for different customer requirements across a lot of industry domains.…

Top 6 Salesforce Winter ’21 Features to Enhance Your Sales Results for CPQ
Hello Everyone! It’s that time of the year again when the buzz is around the Winter ‘21 feature releases for. In this blog, we are…

System Mode and User Mode in Salesforce
System mode implies running apex code by overlooking the user's authorizations. User mode understands the running apex code by concerning the user’s support and sharing…
Popular Salesforce Videos
Getting your Customer on Track with Salesforce
Hear from Jonathan Gardner, Head of CRM Development First Group, and Lee Holsgrove, Client Adviser IBM as they discuss First Group's transformation bringing together a…
Create Targeted Campaigns w/ Marketing Cloud Advertising | Salesforce Demo
Explore the power of using 1st party data to power ad audiences across the most popular ad channels today, including Google (Search, Shopping, YouTube, Gmail),…
Salesforce Connections 2018 Keynote - Ch. 4: U.S. Bank Is A Trailblazer
Salesforce Connections 2018 Keynote – Ch. 1: Corporate Positioning Salesforce Connections 2018 Keynote – Ch. 2: Ticketmaster Is A Trailblazer Salesforce Connections 2018 Keynote –…