You need to sign in to do that
Don't have an account?
Sean McMickle
Sharing OneDrive files using Apex
I have not been able to find any documentation regarding sharing OneDrive files using Apex. Does anyone have an example or a resource that they could give?
I would like to be able to use condition based triggers to attach particular files from particular folders from OneDrive to particular objects.
Thanks!
-Sean
I would like to be able to use condition based triggers to attach particular files from particular folders from OneDrive to particular objects.
Thanks!
-Sean
1. First you need to authenticate with onedrive to perform any operation from the external system. Using name crendtials you can authenticate into oneDrive without hard coding user crendtials in the apex class.
OneDrive oAuth process - https://dev.onedrive.com/auth/msa_oauth.htm
Salesforce external authentication providers - https://help.salesforce.com/htviewhelpdoc?err=1&id=sso_authentication_providers.htm&siteLang=en_US (https://help.salesforce.com/htviewhelpdoc?err=1&id=sso_authentication_providers.htm&siteLang=en_US)
Salesforce Named Crendtials - http://https://help.salesforce.com/HTViewSolution?id=000206761&language=en_US (http://https://help.salesforce.com/HTViewSolution?id=000206761&language=en_US)
2. Then you have make http callouts from salesforce to write files in the OneDrive folder
Write files in OneDrive - https://dev.onedrive.com/items/create.htm
Apex HTTP callouts - https://developer.salesforce.com/docs/atlas.en-us.200.0.apexcode.meta/apexcode/apex_callouts_http.htm
Apex HTTP callouts Trailhead module - https://developer.salesforce.com/trailhead/apex_integration_services/apex_integration_rest_callouts
Refer blog https://salesforcecodex.com/2020/09/uploading-files-to-microsoft-one-drive-using-apex/ for direct integration with Microsoft one drive using apex.
Thank you,
Dhanik
Read more here (https://blog.skyvia.com/onedrive-salesforce-integration/)