!!!1. Sharepoint Microsoft Graph REST API based integration.\\
__Remote item name:__ Sharepoint\\
\\
__!!!Constraint:__ Microsoft Graph REST API does not support stream upload. In order to integrate with CrushFTP the files are temporary stored as local file (CrushFTP install folder/sharepoint/) during the upload.\\
\\
Go to the the Microsoft azure portal: [https://azure.microsoft.com/en-us/features/azure-portal]/\\
\\
__Application registration: __Go to the App registrations and click on New registration:\\
\\
[attachments|new_registration.png]\\
\\
Name it. Select the Multitenant and personal Microsoft accounts type. The redirect url must ends with: register_microsoft_graph_api/. Then click on register.\\
\\
[attachments|register_app.png]
\\
__API permission :__ You also need to provide permission for the Microsoft Graph. Go to the Api permission. Click on Add permission, select Microsoft Graph. Choose Delegated permission and add the "Files.ReadWrite.All" permission:\\
\\
[attachments|permission_microsoft_graph.png]\\
[attachments|permission_final.png]\\
\\
__Client id : __ You can find it at Azure portal -> App Registration -> Overview:\\  
\\
[attachments|client_id.png]\\
\\
__Secret key :__ A new client secret needs to be created as well. Go to the "Certificate & secrets" and generate a new secret key. Click on New client secret.\\
\\
[attachments|new_secret.png]\\
[attachments|secret_value.png]\\
\\
__SharePoint remote item settings:__\\
\\
__!!! CrushFTP admin page url must match with the redirect url.__ In our example : http://localhost:9090\\
\\
Select SharePoint item type click on "Get Refresh Token" button. Provide the Client ID and Client Secret, and Tenant (in almost all case it is just: common).\\
\\
[attachments|remote_item_settings.png]\\
\\
Click on "OK" button, log in with your azure credentials, allow CrushFTP to have access to your SharePoint files. After that the form will disappear and the username and password will be filled. Done.\\
\\
[attachments|remote_item_done.png]\\
\\
__Sharepoint specific settings:__\\
\\
[attachments|remote_item_sharepoint_specific_settings.png]\\
\\
__Site id__ : The sharepoint domain name.\\
__Site Path__ : The path of the SharePoint site. It should start and end with slash.\\
__Drive name__ : Each SharePoint site has document library where the site related files are stored. See [https://support.microsoft.com/en-us/office/what-is-a-document-library-3b5976dd-65cf-4c9e-bf5a-713c10ca2872] Provied it's name\\
__Folder__ : Relative path of the document library of the sharepoint site.
\\
!!! 2. SharePoint REST service API based integration\\
__Remote item name:__ Sharepoint2\\
\\
More info : [https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service?tabs=csom]\\
__!!!Constraint:__ On newer Sharepoint (after 2019) Grant App permission is disabled by default. To enable Custom Application APP Authentication run the following PowerShell commands:\\
{{{
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
$adminUPN="<SharePoint administrator account>"
$orgName="<name of your Office 365 organization>"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
set-spotenant -DisableCustomAppAuthentication $false
}}}\\
\\
 __Advantage(Compared with MSGraph API)__: Stream upload supported. There is no temporary stored local file during the upload.\\ 
\\
__1. Register Add-In__\\
Navigate and login to SharePoint online site. Got to Register Add-In page by entering the url as: \\
 
{{{https://<sitename>.sharepoint.com/<<site path>>/_layouts/15/appregnew.aspx}}}\\
\\
Click Generate button.\\
\\
[attachments|app_reg_new.png]\\
\\
Store the __Client ID__ and __Client Secret__ and click on __Create__ button.\\
\\
[attachments|app_reg_new_success.png]\\
\\
__2. Grant Permissions to Add-In__\\
\\
Navigate to: \\ 
{{{
 https://<sitename>.sharepoint.com/<<site path>>/_layouts/15/appinv.aspx
}}}\\
 \\
This will redirect to Grant permission page. Enter the __Client ID__(generated earlier), in __AppId__ textbox and click Lookup button.\\
Provide the permission Request xml and click on __Create__ button.\\
\\
[attachments|app_inv_permission.png]
 \\
__SharePoint2 remote item settings:__\\
\\
__User name__ : The created __Client ID__\\
__Password__ : The created __Client Secret__\\
__Site id__ : The sharepoint domain name.\\
__Site Path__ : The path of the SharePoint site. It should start and end with slash.\\
__Drive name__ : Each SharePoint site has document library where the site related files are stored. See [https://support.microsoft.com/en-us/office/what-is-a-document-library-3b5976dd-65cf-4c9e-bf5a-713c10ca2872] Provied it's name\\
__Folder__ : Relative path of the document library of the sharepoint site.\\
\\
[attachments|sharepoint2_vfs.png]\\
\\