The perfect match of the best CRM (Salesforce) and a feature-stuffed Microsoft-powered document management system SharePoint
Making SharePoint Site Ready (Microsoft o365 Account is needed)
Create a Microsoft SharePoint trial account in the case already does not exist (Developer trial). This would help you get access to MS o365 Trial for 90 days including SharePoint access.
- Launch https://developer.microsoft.com/en-us/microsoft-365/dev-program and click on Join now, and fill in the required details
- Complete details here to create an MS o365 Trial Account: https://www.sharepointdiary.com/2021/05/how-to-create-sharepoint-online-free-trial-account.html
- Once done, you can check your complete profile here: https://developer.microsoft.com/en-us/microsoft-365/profile which includes your domain name e.g. below, and Administrator user name: example: 6kn6y3.onmicrosoft.com
- Once your SharePoint access is ready, you need to create a new site (Private or Public) from https://6kn6y3.sharepoint.com/_layouts/15/sharepoint.aspx
- Create Site > Create a site > Type = Team Site > Give it a Site Name and Site Description and note down the site URL
6. The site URL should be like: https://6kn6y3.sharepoint.com/sites/fileconnectwithsp
where fileconnectwithsp is the site name.
Enable Salesforce File Connect in Salesforce
- From Setup, search for Files Connect and make sure it is Enabled:
2. File Sharing can be selected Copy or Reference as per client need:
User Permission Sets Creation for Files Connect access
- Create a new permission set: FilesConnect Permission Set
- Add below access to this permission set record:
Add this System permission: and assign it to respective users who need SharePoint access from Salesforce.
Files Connect Cloud: Access cloud-based external content sources, such as SharePoint Online.
Auth. Provider Setup inside Salesforce
Auth. Provider Salesforce Documentation: https://help.salesforce.com/s/articleView?id=sf.admin_files_connect_overview.htm&type=5
Auth. Provider Detail
Go to Salesforce Setup > Auth Providers and create a new record with Provider Type = Microsoft Access Control Services. It supports a lot of provider types including Google, Apple, Facebook, Twitter, Slack, LinkedIn, and so on.
Enter the Name and URLSuffix, and for the time being, enter a dummy value for Consumer Key, Consumer Secret, Authorize Endpoint URL, and Token Endpoint URL (you may have to include HTTP:// for getting the URL fake values right.
Later these details to be confirmed and taken from the SharePoint App which we would create in the upcoming steps. Final Details are updated in the screenshot for time saving.
Complete details should look like as below:
Where
- In the field of Authorize Endpoint URL, you would have to enter the value https://[your company name].sharepoint.com/[site collection path]/_layouts/15/OauthAuthorize.aspx
- In the field of Token Endpoint URL, enter the value https://accounts.accesscontrol.windows.net/[your company name].onmicrosoft.com/tokens/OAuth/2?resource=00000003–0000–0ff1-ce00–000000000000/[your company name].sharepoint.com@[your company name].onmicrosoft.com
where [your company name] = 6kn6y3 in our case. This will vary in every case as per the SharePoint account details.
Create SharePoint App for Salesforce integration
This SharePoint App details would be needed to re-configure the Auth. Provider in earlier steps once our App is ready and configured.
- We can create a new SharePoint App by appending _layouts/15/appregnew.aspx at the end of the SharePoint Site Collection URL [sites/fileconnectwithsp]
- URL Format : https://[your company name].SharePoint.com/[site collection path]/_layouts/15/appregnew.aspx
- For our project, the full URL should be https://6kn6y3.sharepoint.com/sites/fileconnectwithsp/_layouts/15/appregnew.aspx. This would launch the below page where Client Id and Client Secret can be generated by the buttons given and the rest of the details can be entered manually as per the requirement.
4. Create a new App named SharePointOnlineFC with below final details: The app identifier has been successfully created:
Please note them down in a notepad for later usage.
Where
App Domain: is Salesforce classic base URL and
Redirect URI: is the Callback URL from the Auth. Provider** (URL below for our Salesforce org.) https://playful-otter-pxypju-dev-ed.lightning.force.com/lightning/setup/AuthProviders/page?address=%2F0SO5h0000000BrP
Auth. Provider set-up would be done in the next few steps.
Configuring SharePoint App for Salesforce integration
- We need to configure our newly created SharePoint App for the necessary level for Access grants, by appending _layouts/15/appinv.aspx at the end of the SharePoint Site Collection URL [sites/fileconnectwithsp]
- Complete URL format: https://[your company name].SharePoint.com/[site collection path]/_layouts/15/appinv.aspx
- For our sample project, the full URL should be : https://6kn6y3.sharepoint.com/sites/fileconnectwithsp/_layouts/15/appinv.aspx
- App Id is the Client Id for the newly created App above. Search with App Id = Client Id and click Lookup. It will search and Load the App created in the previous step.
- This will auto-populate the values of other boxes except for Permission Request XML. The value of Permission Request XML, as the title suggests, defines the level of access the connecting application will have in respect to accessing SharePoint files collections. The standard input is as below:
<AppPermissionRequests> <AppPermissionRequest Scope=”[SCOPE]” Right=”[PLACEHOLDER]”/> </AppPermissionRequests>
For SharePoint Online, replace [SCOPE] with one of these values.
IMPORTANT Office 365 recognizes only these scope URLs; copy them exactly, without changes.
- http://sharepoint/content/sitecollection/web so users can access a single site (but not its subsites).
- http://sharepoint/content/sitecollection so users can access a single site collection (including all subsites).
- http://sharepoint/content/tenant so users can access all site collections.
Replace [PLACEHOLDER] with one of these values:
- Read
- Write
- Manage
- FullControl For details about the differences between permission levels above, see the Microsoft website.
Configuring External Data Sources, using the Auth. Provider created above
- Within Salesforce, create a new external data source with the below details, using the Auth. Provider created in the earlier steps.
For the new External Data Source, select Type = File Connect: Microsoft SharePoint Online
2. At the end once setup, click Validate and Sync in order to Sync the data/tables from the external system (SharePoint in our case)
3. Once Sync Status = COMPLETE, a new Table gets inserted and a new External Object got created items_SharePointFileConnect
4. Sometimes, errors might come while Validate and Sync, just wait or refresh the page to get the latest status until Status = COMPLETE
5. External Data Source page layout can be adjusted to show the required fields as needed by the business, under Set up > External Objects > Page layout > Edit
User Permission Sets Creation for Files Connect access
- Now we need to add newly created Custom Object (External) and External Data Source to the already created permission set: FilesConnect Permission Set in one of the earlier steps
- Add below access to this permission set record:
Add below permissions : and assign to respective users who need SharePoint access from Salesforce. In this case, assign to your user.
Validating if Salesforce can access the SharePoint Files
- Salesforce Lightning > go to Files tab, you should be able to see a New Connected Source which is created above
2. Salesforce classic: Go to any object (let’s say Opportunity) > Under Files > Select a File from Salesforce > Click
3. You should be able to see All files and folders from the SharePoint path: https://6kn6y3.sharepoint.com/sites/fileconnectwithsp/Shared%20Documents/Forms/AllItems.aspx
4. Select any file and it gets attached to the Salesforce Opportunity record.
Troubleshooting
If you see errors like ‘You are not authorized to perform that operation in Files Connect Office 365 It means SharePoint App was not provided proper level of access using SCOPE and RIGHT properties.
Refer to the below article to fix the same:
https://help.salesforce.com/s/articleView?language=en_US&type=1&id=000335285
Congratulations, it confirms that Salesforce to SharePoint integration is working perfectly. !
References:
https://help.salesforce.com/s/articleView?id=sf.admin_files_connect_overview.htm&type=5
https://help.salesforce.com/s/articleView?id=000335285&type=1
Developer details:
- Twitter: @sombirsheoran
- LinkedIn : https://www.linkedin.com/in/sombirsheoran
Please reach out to me for any suggestions or feedback. Would love to hear them ❤
This article was originally post at : https://sombir-sheoran.medium.com/integrating-salesforce-with-microsoft-sharepoint-using-file-connect-e6e6a39e3103
I want to learn new things…
Please go ahead. Anything stopping you?