-
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

What are Sandboxes in Salesforce?
Salesforce sandboxes are copies of your Production environment. A sandbox contains all the configuration, customization, apps and code (known as metadata) that you have made to…

Best Practices For Defining Business Processes In Salesforce
The meaning of the term business process and the advancement of this definition since its origination by Adam Smith in 1776 has prompted such territories…

Running Metadata API in Apex as a specific user
Running Metadata API in Apex as a specific user Calling the metadata API in Apex requires admin permission or at least the "Modify All Data"…
Popular Salesforce Videos
Understanding Leads, Accounts, Contact, Opportunities, Products, Pricebooks objects in Sales Cloud
In this video, I have explained how Salesforce SalesCloud can boost your companies productivity. Some Important object of Sales Cloud : 1. Campaign 2. Lead…
Create a New Marker Layer in Maps | Salesforce Maps
Salesforce Maps is a location intelligence and map visualization tool that integrates with your Salesforce CRM, simplifying territory management. With Salesforce Maps you can create territories…
Which Salesforce Certifications are Really Important?
If you really want to know which Salesforce certifications are really important then this video is for you. If you have any doubts or concerns,…