-
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
Top Salesforce Winter '22 Release Features
Salesforce has three big releases coming out each year to make it more user-friendly. Each new release is loaded with features. These features help the…
How to Solve Employee Productivity Issues by Optimizing Salesforce for Your Team
In 2026, companies using CRM systems report that improving user adoption directly increases productivity by 25% or more. Studies show that 58% of sales teams…
Introduction and How to Use Postman | Salesforce Developer Guide
Introduction Postman is a computer application it is used for testing APIs (Application Programming Interfaces). Postman sends an HTTP request to the webserver and receives…
Popular Salesforce Videos
How To Become a Salesforce Developer [Perfect Guide for Beginners]
Curious about a career in Salesforce development? Our video is your concise guide to getting started. What's inside:→ The average salary for a Salesforce Developer…
Building a Custom UI with Lightning Web Components | Salesforce Tutorial
Lightning Web Components is a modern JavaScript framework that leverages the web standards breakthroughs over the past few years. Watch this session to understand how…
Salesforce Commerce Cloud Migration Key Considerations
Embarking on a Salesforce Commerce Cloud migration journey? This extract from our latest webinar outlines the key considerations and best practices to ensure a seamless…