Business Use Case
As accounts in Salesforce reach certain status then business wants new SharePoint folder to be created with same name and as users add files to that account then those files would be synced over to SharePoint in the appropriate folder.
I've setup a SharePoint auth. provider and external data source in my Salesforce sandbox. I can successfully browse my SharePoint site and navigate folders and view files. I can use the
ConnectApi in Apex to create new files in SharePoint.
How can I create new folders in SharePoint via the
ConnectApi in Apex?
As far as I can tell, since
ConnectApi.ContentHub.getAllowedItemTypes only returns to me a
ConnectApi.ContentHubAllowedItemTypeCollection with one
ConnectApi.ContentHubItemTypeSummary record that represents a file then my only recourse to create folders is to make http callouts from apex to the SharePoint REST API directly rather than use the
ConnectApi in Apex.
I much rather prefer to use the
ConnectApi in Apex as its a nicer abstraction of the actual SharePoint / Box / Google Drive APIs than making the http requests myself.