You need to sign in to do that
Don't have an account?
Fabio Andree Scheurel MW
Files Connect and APEX: attach external (SharePoint) file to record
I have configure SharePoint Online successfully as my external document management and file storage system using the standard Files Connect adapter.
Now I want to attach a file that is stored in SharePoint to a Salesforce Record, in APEX code. However I was not able to figure out how this might be possible. Anyone succeeded in doing this? I would also go for creating a Chatter post in APEX, but the FilesCapabilities do only support linkage to existing ContentDocument record, but my SharePoint files are not (yet) listet there.
Now I want to attach a file that is stored in SharePoint to a Salesforce Record, in APEX code. However I was not able to figure out how this might be possible. Anyone succeeded in doing this? I would also go for creating a Chatter post in APEX, but the FilesCapabilities do only support linkage to existing ContentDocument record, but my SharePoint files are not (yet) listet there.
See https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentversion.htm and https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm
ExternalDataSourceId is the ID of the External Data Source, ExternalDocumentInfo1 is the full URL to the preview on the Sharepoint where the user will be redirected to after clicking onto "Open in Sharepoint" when looking at the file preview in Salesforce, and ExternalDocumentInfo2 is the file identifier on the SharePoint server in the form of
item:<Root Path in Base64 encoding>:<List View ID>:<List Item ID>
Hope that helps.
All Answers
See https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentversion.htm and https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm
ExternalDataSourceId is the ID of the External Data Source, ExternalDocumentInfo1 is the full URL to the preview on the Sharepoint where the user will be redirected to after clicking onto "Open in Sharepoint" when looking at the file preview in Salesforce, and ExternalDocumentInfo2 is the file identifier on the SharePoint server in the form of
item:<Root Path in Base64 encoding>:<List View ID>:<List Item ID>
Hope that helps.
Looks like you were able to find some workaround for linking files back to records.
For my scenario, I want to link the Sharepoint file as an attachment on the record, not only the URL. Any thoughts on this?
I am not sure whether attachments allow integration with SharePoint at all, I think it is limited to Salesforce Files. I would consider switching from attachments to files, where my solution mentioned above works.
Best Regards
Fabio
Thisi is my usecase - Currently not all users have to access to Sharepoint, therefore I want to automate file linking with records, so that users can download these files directly from Salesforce. I have enabled Files Sharing as "Copy" on File connect settings.