# Office 365 SharePoint - Custom App

## Objective

This document will demonstrate how easy it is to integrate Office 365 SharePoint to the iX Hello platform, create methods to pull data, and publish to Amazon Lex to test the skills.

## Pre-requisites

1. **An active Office 365 Account**

User should have an active Microsoft Office 365 Account. If user does not have an active account, the user can create one at: [https://signup.live.com/signup](https://signup.live.com/signup?lic=1\&uaid=dcccc7d3501844919762928e146c9308)

2. **At least one App Registration**

Open your Azure account. If user does not have any App Registration, it can be created by:&#x20;

a. Enter **App Registrations** in the Search field at the top of the Azure page.&#x20;

b. Select the App Registrations icon

c. Click on **New Registration** button

<figure><img src="/files/Q2rMihcx7ltBya1jfLcZ" alt=""><figcaption></figcaption></figure>

d. Enter a Name and select **Accounts in this organizational directory only**. Press **Register**.

<figure><img src="/files/YOTx8Cmip0pOSP9Bg7wn" alt="" width="563"><figcaption></figcaption></figure>

## Application (Client) ID, Tenant ID, Client Secret, Permissions & Authentication

1. To be able to connect to Office365 from the iX Hello platform, one application registration is required, and the user should have permissions to view and execute Office365 functions. Once the application registration is successful, you can copy the information as described in the steps below:
2. User will need to visit the newly created application and note the following information as highlighted with red marker. The Application ID and Tenant ID can be found inside the red contour.

<figure><img src="/files/jJkTsgwazgcTROg2bVD8" alt="" width="563"><figcaption></figcaption></figure>

3. On the left navigation menu, click **Certificates & Secrets**. Click on **New client secret**:

<figure><img src="/files/BV3gb7ubL1562vq3hgoU" alt=""><figcaption></figcaption></figure>

4. A popup will appear. Fill-in the necessary information as shown and press **Next**:

   <figure><img src="/files/oKu4Md3fZR5S8SsJgLTi" alt=""><figcaption></figcaption></figure>
5. App expiration can be customized as shown below:

   <div align="left"><figure><img src="/files/93XwPn9PBT952Qkiv1u6" alt="" width="375"><figcaption></figcaption></figure></div>
6. After user clicks **Add**, the application secret will appear as shown below. Copy the value and store it in a safe location. This information can only be seen once. If this value is lost, it will be necessary to create a new secret.

   <figure><img src="/files/PWFOHEgjmMdRddAyW95Q" alt=""><figcaption></figcaption></figure>
7. User should now have Client ID, Tenant ID, and Client Secret.
8. User will now need to create App permission. On left navigation menu, click **API permissions**, then click **Add a permission**.

   <figure><img src="/files/9Z3OHuQHifE5ym088Gkp" alt=""><figcaption></figcaption></figure>
9. For Office 365 SharePoint permissions, the user will need to have the following delegated permissions: \
   **Sites.ReadWrite.All** \
   **offline\_access** \
   To obtain these permissions, do the following:
   1. Click **Add a permission**
   2. Click **Microsoft Graph** option at top
   3. Click **Delegated permissions**
10. The user will then be able to see the list of permissions that are offered to registered application. Find the permissions stated above and check them. Finally click on **Add permissions** button to complete the permission as shown in picture below

    <div align="left"><figure><img src="/files/HsqFSD06J54N4uGOzdp5" alt="" width="375"><figcaption></figcaption></figure></div>
11. For authentication, the user has to provide redirect URL. This is where Office 365 will redirect after authentication is complete. To setup the redirect URL, click **Authentication** on the left navigation menu and then click **Add a platform** on the body and then select **Web**. Follow the subsequent screenshots as shown below:

    <figure><img src="/files/JIyK3lGKFnn14eeRAIvu" alt=""><figcaption></figcaption></figure>
12. Add the Redirect URL under the Configure Web portion. Enter the value **<https://bots.ixHello.com/OAuthCode/Redirect>** and press **Configure**

    <div align="center"><figure><img src="/files/cgvBDMZvlTGwgqAUxDHu" alt="" width="375"><figcaption></figcaption></figure></div>
13. Once the platform is added, user should see redirect URIs as below:

<figure><img src="/files/S1LmXhyMiC6cgYzn1dRm" alt="" width="563"><figcaption></figcaption></figure>

4. You have now successfully configured App on Azure. Follow the steps below to connect iX Hello with Office 365.

## Steps

To proceed with these steps, you need to have all the pre-requisites satisfied. If you are missing something, please go back and make sure you satisfy all of them.

The following shows the general steps/activities that will be carried out in setting up this integration. **Note:** It is advisable to use same email for signup across the 3 channels below. Step 1 -3 below are compulsory.

1. [Sign up for AWS account](https://console.aws.amazon.com/lex/)
2. &#x20;[Amazon Connect Home](https://console.aws.amazon.com/connect/)
3. [Sign up for iX Hello platform](https://bots.ixhello.com/)
4. Ensure you log in with an Amazon (LWA) account ([https://developer.amazon.com/amazon lex/console/ask](https://console.aws.amazon.com)) account set up by your admin. If you are the account admin, you can follow these instructions to set it up.
5. Set up connection to Office 365 SharePoint
6. Create a custom app in iX Hello.
7. Publish the app.
8. Test the app with Amazon Lex.

## Setup connection to Office 365 SharePoint

1. Login to the iX Hello portal at <https://bots.ixhello.com/>
2. Open **Studio Mode** by pressing the link at the top of the page.

   <figure><img src="/files/ICSAYzhAJ3RH2PWOrk0W" alt=""><figcaption></figcaption></figure>
3. On the left navigation menu, expand **Integration** and click on **Connect System** as shown below:

   <figure><img src="/files/O6T3BtETKj6owTuF4YJ9" alt=""><figcaption></figcaption></figure>
4. The user will be redirected to the **My Connections**. Click **Connections Gallery**.

   <figure><img src="/files/VpRXDcGmFyax4o9IE4uE" alt=""><figcaption></figcaption></figure>
5. Scroll down and choose **Microsoft Office365 SharePoint.** Click **Connect.**

   <figure><img src="/files/Xv0pFGOAWaoxoNcj7ZT2" alt=""><figcaption></figcaption></figure>
6. Once you click **Next**, you will be redirected to the **Microsoft Office365 Instance Configuration** page:

<figure><img src="/files/y0lVfowBibN2Fc1UZMJn" alt=""><figcaption></figcaption></figure>

If you do not have this information ready, please refer to the prerequisites section. The table below explains each of the inputs shown on this screen.

<table data-header-hidden><thead><tr><th width="385">Input</th><th>Information</th></tr></thead><tbody><tr><td>Input</td><td>Information</td></tr><tr><td>Service Instance Name</td><td>You can give any value of your choice.</td></tr><tr><td>Client ID</td><td>This is your Office 365 Application ID.</td></tr><tr><td>Client Secret</td><td>This is your application secret value.</td></tr><tr><td>Tenant Id</td><td>This is the directory ID in Office 365.</td></tr></tbody></table>

7. Fill the required information and click **Go to Connect System**&#x20;
8. This will validate the details and if correct, the integration will be saved, and the user will be redirected to a Microsoft connection page:

<img src="/files/-MVNv7u_muB7jrb48EgI" alt="" width="375">

10. Once logged in, the user will be asked to accept permissions. Click **Accept** and the user will be redirected to ix Hello with a success screen as shown below:

<img src="/files/-MVNv7uapPN5vvcz_Vv4" alt="" width="563">

11. The user has now successfully integrated Office 365 with ix Hello. The user will now need to click **Return to Integration Configuration** to return to the connections page. The user should see Microsoft Office 365 SharePoint in the list as shown below:

<figure><img src="/files/nkMDcP6B9e2F9zWIekkF" alt=""><figcaption></figcaption></figure>

## Creating a Custom App in ix Hello

1. On the left navigation menu, expand **Apps** and select **Custom Apps**. Click **New Custom App**

<figure><img src="/files/txiFSKXYiF69Hi43ZXIu" alt=""><figcaption></figcaption></figure>

2. The user will see the popup screen as shown below:

<figure><img src="/files/I1adSB6ymXV1dXva9eBX" alt=""><figcaption></figcaption></figure>

3. Populate the fields:
   * **Name:** Microsoft Sharepoint App
   * **Custom Skill Type**: Search
   * **Category**: Default
4. Click **Save**.
5. The user should see the new App listed in the Custom Apps:

<figure><img src="/files/CDQXSde9TiBDamFGrRqv" alt=""><figcaption></figcaption></figure>

## Creating a Data Source

1. A Data Source connects the App with the integration. To add a Data Source, click on the App name in the listing. A page of App contents will appear.
2. To add a Data Source to the new App, first check that the desired App appears in the Current App field. Open the **Data Sources** tab in the top tabs and press **Create New Data Source**.

<figure><img src="/files/yMCyy9RWzCLHUrbeJ3ia" alt=""><figcaption></figcaption></figure>

3. A popup screen will open:

<figure><img src="/files/DRTlQh43DEoi6Ly61sOG" alt="" width="375"><figcaption></figcaption></figure>

4. Add DataSource by doing the following:

**Name:** SharePoint DS

**Integration Configuration:** Select Microsoft Office365: Office365

**Click**: Save.

## Create Methods to fetch the data from Office 365 SharePoint

1. Methods allow the user to interact with Office 365 SharePoint data.

As of the publication of this document, the ix Hello platform supports following Office 365 methods:

**GetAllSites**

**GetSite**

**SearchSites**

**GetAllLists**

**GetList**

**SearchList**

**GetAllListItems**

**GetListItem**

**SearchListItem**

**PostListItem**

**PutListItem**

**DeleteListItem**

2. Depending on the users requirements, the user will need to choose the appropriate Methods. This document will explain one Methods with an example and the rest of Methods will be on the appendix section. Let’s start with a use case.

### **Scenario/ Use Case (Read Emails):**

1. The user will want to find a contact stored in SharePoint. For this, you can use *SearchListItem* Methods as explained below.
2. To access the Methods, click on “**Methods**” tab at the top as seen below.

<figure><img src="/files/uTdDXwzfRS1csEDrQhqw" alt=""><figcaption></figcaption></figure>

3. Click “**Create New Methods**”. Then select or enter the following:

**Name**: FindContactMethod

**Request Type**: SearchListItem

**SiteId**: Select your SharePoint site

**ListId**: Contacts

**ListItemSearchCondition**: Title={{ContactName}}

**Result Type**: ListOfRecords

**Record Limit**: 10

**Record JsonPath:** $.value\[\*].fields

**Empty Result Template:** Sorry, I could not find the contact details

**Record Template:** Phone number of {{Title}} is {{Phone}}

**Result Template:** {{Records}}

**Click:** Save

<figure><img src="/files/PdyhsVayTPBTi4R3Ava3" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/uNZbM3z6k66YTEJYqJuV" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/whysZA9GWaN7QlqhvDjI" alt="" width="563"><figcaption></figcaption></figure>

Once clicked "Save & Test", you will be seeing the below pop-up window, under contact name type Sam and click on "Method Test", under results, you see the details of the contactname : Sam

<figure><img src="/files/VmoTZ9TxVPWW3ovFvL6f" alt="" width="563"><figcaption></figcaption></figure>

## Create Intents

1. In the top menu tabs, select “**Intents**” and “**Create New Intent**”. Then select or enter the following:

**Name:** FindContactIntent

**Intent Type:** Search

**Intent Action:** Execute Method

**DataSource:** SharePoint DS

**DataSource Method:** FindContactMethod

**Click:** Save

<figure><img src="/files/hU8Dyvp12ai4ncrN4tNs" alt="" width="536"><figcaption></figcaption></figure>

## Create Slots

1. In the top menu tabs, select “**Slots**” and select “**Create New Slot**”. Now input or select the following:

**Name:** ContactName

**Slot Order:** 0

**Reprompt Message:** What's the contact name?

**Type:** FullName

**Click:** Save

<figure><img src="/files/nSN0RY73ctXByfgGPsM7" alt="" width="531"><figcaption></figcaption></figure>

## Create Utterance

1. In the top menu tabs, select “**Utterance**” and select “**Create New Utterance**”. Utterance are words spoken to launch specific intents. Now input or select the following:

**Value:** find a phone number

**Custom Skill:** Microsoft SharePoint Skill

**Intent:** FindContactIntent

**Click:** Save

<figure><img src="/files/Q1GFSQA00mOeyzLiuYo6" alt="" width="535"><figcaption></figcaption></figure>

## Create Input

1. In the top menu tabs, select “**Input**” and select “**Create New Input**”. Then input or select the following:

**Name:** FindContactInput

**Custom Skill:** Microsoft SharePoint Skill

**Custom Intent:** FindContactIntent

**Data Source:** SharePoint DS

**Data Source Method:** FindContactMethod

**Click:** Save

<figure><img src="/files/jclThUzvTdgn0R0bJTtR" alt="" width="533"><figcaption></figcaption></figure>

2. On the input page, once input is created, click on “**Manage Parameters**”.

<figure><img src="/files/HmI39XYnHEgFJYo4ibO7" alt="" width="563"><figcaption></figcaption></figure>

3. On Manage Parameters page inside Input, click “**Input Parameter**”. Then input or select the following:

**Input Parameter Name:** ContactName

**Parameter:** ContactName

**Data Type:** Text

**Click:** Save

<figure><img src="/files/G0fqzHFQN4cEMoGUophO" alt="" width="530"><figcaption></figcaption></figure>

## **Publish to Amazon Lex**

1. To publish to Amazon Lex, select “**Publish**” in the top menu tabs then click “**Add App Publishing**”. Then input or select the following:

**External Skill Name**: SharePoint Assistant (This will be the name of the skill in Amazon Lex. Therefore, make it unique and different from the names of your other skills in Amazon Lex.)

**App Description:** Microsoft SharePoint Skill

**Skill Type**: Search

**Channel**: Amazon Lex

**Uncheck the following**: Require account linking, Auto Publish

**Optional**: Replace all placeholder values in all “Message”. Uncheck all the settings shown in the second image below.

**Click**: Save.

<figure><img src="/files/tf8k3M3ibgwFtOiD9kTT" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/xqstSqGIA2o9PiMBAmre" alt=""><figcaption></figcaption></figure>

2. Once in Publish Skill to Amazon Lex select and do the following:

**Selected App**: Microsoft SharePoint Skill

External App Name: SharePoint Assistant

Amazon Lex Version: V2

**Select Amazon Lex Account:**&#x20;

Select the Lex account setup by your admin or the one you set up in step 4 above.

**Click**: Publish To Amazon Lex

<figure><img src="/files/LGtVQtJtxqsBu13XGrIN" alt=""><figcaption></figcaption></figure>

3. On the resulting screen, ensure that a success message shows for the publishing steps before clicking “**Test Lex**”. If success message not shown, click “**Go Back to App Publishing**” to fix any issue shown in publishing result.

<figure><img src="/files/qxaPK0B9CRbQfMEwAoAE" alt="" width="563"><figcaption></figcaption></figure>

4. Once clicked on "**Test Lex Bot**", you will be redirected to App Publishing screen, and the Test Bot will appear at the right corner showing the App name along with the welcome message:

<figure><img src="/files/xqQSZHM94ffaJAT8KrGy" alt="" width="563"><figcaption></figcaption></figure>

5. Query the bot with the Utterance "Find a phone number" and then provide the contact-name of whom you would like to see the phone number, for ex: type Jeremiah. Bot will provide the response with the full name and the phone number.

<figure><img src="/files/G64WYwAxhv7xoRbiAo9U" alt="" width="563"><figcaption></figcaption></figure>

Congratulations!

You have successfully completed building Office 365 Custom Skill.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc/apps/office-365-sharepoint-custom-app.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
