The intention of this project is to create a collaborated effort for SharePoint integration and create a good and stable solution that works for most SharePoint projects.
This module integrates with SharePoint using the SharePoint SOAP Web Services. It’s using the SOAP services since that is the most widely supported and most powerful way to integrate SharePoint with Services.
The SharePoint Module currently supports:
1. Consuming SharePoint data in lists with the Feeds module.
2. Consuming SharePoint data in lists with the Views module.
3. Use SharePoint Search within your Drupal Site.
project to build an app for SharePoint using PHP. You can use the TokenHelper class in your project to get access tokens that work with SharePoint app. The project also includes an example page that shows how to use the TokenHelper class to contact a REST endpoint in SharePoint.
PHP App to SharePoint flow diagram
Create a web application
This document is configured to use a web application that resolves to PHPAPP. To make it easier to configure your app we recommend that you use PHPAPP as your web application name. Follow the procedure provided below to create the web application:
- Create a web application on your web server with a name of PHPAPP.
- Map the web application physical path to the PHP xampp folder included in the sample.
Note: The web application must be configured to use SSL Certificate(Contact web hosting provider for more querries).
Register your app in SharePoint
Since you’re not installing the app from the Office Store, you must register your app in SharePoint before deploying it you need to Follow this procedure to register the app into Sharepoint:
- Open a browser and go to https://samplesharepointsite/_layouts/16/newapp.aspx
- Fill the following fields in the page:
- Client Id – Click the Generate button to let SharePoint create a value for you.
- Client Secret – Click the Generate button to let SharePoint create a value for you.
- Title – PHPApp for SharePoint
- App Domain – localhost
- Redirect URI – https://localhost/PHPAPP/index.php
- Copy the values from store for future references. You will need them to update the configuration and app manifest files.
- Click on Create.
Note: If you specify a title other than PHPApp for SharePoint you must update the Name attribute of the App element in the app manifest accordingly name provided.
Update the configuration file
The sample requires the client_id, and client_secret values from the app registration page in the previous task. To update this values in the config.php file, follow this procedure:
- Open the config.php file provided in this sample in a text editor.
- Copy the client_id, and client_secret values that you got in the previous task to the placeholders in the file.
3. $client_id = “<your client_id value>”;
4. $client_secret = “<your client_secret value>”;
- Save the config.php file.
Update the app manifest
The AppTemplate.app file is an app package that contains the app manifest file. You have to update the app manifest file with the client_id value obtained in the Register your app in SharePoint task. Follow this procedure to update the app manifest file:
- Go to the root folder of the sample.
- Rename the AppPackage.app file provided in this sample to AppPackage.zip
- Open the zip file and extract the AppManifest.xml file.
- Edit the AppManfest. xml file. Replacewith the Client Id value from the app registration page.
6. <RemoteWebApplication ClientId=”<your client_id value>”/>
- Replace the AppManifest.xml file in the zip file.
- Rename the AppPackage.zip file back to AppPackage.app
Note: The updated AppPackage.app file must keep the same file structure as the original. Moving files or folders can invalidate your package.
Deploy the app to the SharePoint site
You can deploy the app using the app catalog that lets administrators deploy business apps to SharePoint sites in the tenant.
- If you don’t have an app catalog site in your tenant, create one. For more information, see Create an App Catalog site.
- Add the AppTemplate.app file to the app catalog. For more information, see Add custom apps to the App Catalog site.
- Go to the SharePoint site where you want to deploy the app. From the Settings menu (the gear in the top right corner of the page) choose Add an app.
- Choose the PHP App for SharePoint app. In the consent page, choose Trust It option.