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.

Current Setup

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.


1 Answer 1


As of May 25, 2017, the ConnectApi in Apex does not support creating folders.

Confirmed by Salesforce product managers Arnab Bose and Haris Ikram.

In the meanwhile, please vote for this idea: Ability to create Folders using Files Connect Repository Resources

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .