-
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
Use Salesforce Lightning Component in Visualforce Page
In winter ‘16 a new and powerful feature was introduced which allows you to implement your Salesforce Lightning Component in Visualforce pages. There are three…
Salesforce Implementation Guide - All You Need to know
In 2021, it is safe to say that the world revolves around extracting, accessing, and managing data. It has rightly been called the “digital gold”…
Component Event Propagation in Salesforce - A Short Guide
The framework supports capturing and bubbling phases for component event propagation. These stages mimic the DOM processing pattern and give interested components a way to…
Popular Salesforce Videos
Practice Questions and Test for Salesforce Administrator ADM 201 Certification Exam | 2021
In this video, Shrey provides a practice test for the candidates who are preparing for the Salesforce Administrator exam. This test boosts your confidence and…
Salesforce Summer '22 Release Highlights | Salesforce Video Tutorial
It's time for Salesforce's Summer '22 update release! This release is chock-full of exciting customization updates ready for you to use within your Salesforce organization.…
Salesforce Spring 22 Treasure Hunt for Flow | Migrate your Workflow Rules to Flows
Salesforce Spring 22 Treasure Hunt for Flow 0:00 Register for pre-release org 0:27 Flow Trigger Explorer 2:07 Auto-Layout and Freeform option as Picklist 3:00 Set…