Editing and viewing electronic files with OneDrive
The configuration described in this article is applicable to version 3.0 of the system. For the configuration of previous versions, click here.
Prerequisites
- Access to the Configuration > General parameters (DC035) menu.
- Access to the File > Document (DC003/DC010) menu.
- Microsoft Entra ID user with Global Admin privilege.
- SoftExpert Document user with "View", "Edit", and "Save locally" controls allowed in the security list of the document.
- Allow original file download in the view mode parameter checked in the General section of the Configuration > General parameters (DC035) menu.
- Document in the "Revision" or "Indexing" step.
Introduction
The Document component allows for using Microsoft OneDrive to edit and view electronic files during the revision or indexing step.
When this resource is used, files are opened directly through Office 365 applications (Word, Excel, PowerPoint, etc.) and, once the revision is completed, they are automatically stored again in the Document component.
For this feature to be enabled, it is necessary to integrate the Microsoft 365 API with the Document component, which ensures that electronic files can be edited later with the Office package.
Below, see the procedures you need to perform in order to use this resource.
Creating a site in your company's SharePoint
- In order to take the following steps, you must have a Microsoft 365 account with access to SharePoint and permission to create sites in the organization.
- We strongly recommend creating a new site exclusively for the integration. This site will be used to temporarily store the files during the viewing and editing processes carried out by the system.
- To ensure the security of the information, we recommend the site be private. The application will automatically control accesses, in accordance with the user's permissions and the operation executed in SoftExpert Document.
1. Access SharePoint.
2. Log in with your Microsoft work account.
3. Click on SharePoint or go directly to: https://yourdomain.sharepoint.com.
4. Click on the + Create site in the upper left corner of the screen.
5. Choose the desired site type for the team.
6. Set up the site by filling in the following fields:
- Site name: enter the name of your site. Suggestion: SoftExpert Document.
- Description (optional): describe the site's purpose. Suggestion: "Site intended for integration with SoftExpert Document".
- Privacy: private.
- Site address (URL): SharePoint automatically generates the site's address (URL), but it is possible to adjust it, if you wish.
7. Add the site's owners and members (or skip this step and add them later).
8. Click on Finish
Setting up the Microsoft 365 API
Part 1: Initial app registration
1. Access the Microsoft Entra portal.
2. In the side panel, go to Identity > Applications > App registrations.
3. Select the New registration option.
4. Fill in the fields that will be displayed:
-
Name:
SoftExpert Document -
Supported account types: select the
Accounts in this organizational directory onlyoption. -
Redirect URL (optional): select the
Weboption and fill in the field next to it with http://localhost.
5. Click on Register.
Part 2: Basic configuration and ID collection
1. On the "Overview" screen that will be shown, copy the following values and keep them somewhere safe, as they will be used later:
- Application ID (client)
- Directory ID (tenant)
2. In the Manage section of the side panel, click on Branding and Properties.
3. Fill in the Homepage URL field with http://localhost and click on Save.
4. Still in the Manage section, click on Owners.
5. If your user (or the appropriate service user) does not appear on the list, select the Add owners option, locate and select the intended user, and click on the Select button.
Part 3: API permission configuration
1. From the side panel, in the Manage section, click on API permissions.
2. Click on the Microsoft Graph User.Read permission. It will be displayed by default as granted.
3. In the panel that will be displayed, click on the Remove permission option and confirm the deletion.
If the "Unable to complete due to service connection error, please try again later" error occurs, please wait a few hours and try again.
4. Back to the "API permissions" main screen, click on Add a permission.
5. In the side panel, click on Microsoft Graph.
6. Choose the Application permissions option.
7. In the search box, type Sites.Selected.
8. Check the Sites.Selected option and click on the Add permissions button.
9. After adding the permission, click on the Grant admin consent for [Your Directory] button and confirm the action.
Part 4: Client secret creation
1. From the side panel, in the Manage section, click on Certificates and secrets.
2. In the Client secrets tab, click on New client secret.
3. In the panel that will be displayed, fill in these fields:
- Description: enter a value such as “Admin” or “SoftExpertDocument_Secret”.
- Expires on: select the 24 months option (or the desired period).
4. Click on Add.
5. The secret will be shown on the list. Copy the content of the Value column and keep it somewhere safe, as it will be used later.
The client secret value is shown only once. If you exit the screen without copying the value, you will need to create a new secret.
Obtaining the site's ID
Part 1: Preparation - Authenticating in Graph Explorer
Before performing any queries, you must authenticate yourself and ensure that the Graph Explorer tool has the right permissions to act on behalf of the logged user.
1. Access Graph Explorer.
2. In the upper-right corner, click on the Sign in icon and authenticate yourself with your administrator account (Global Admin or SharePoint Admin).
3. Upon logging in, click on the Modify permissions tab.
4. In the search box, look for the following permissions and click on Consent:
-
Sites.Read.All(permission to find the site in part 2) -
Sites.Selected(permission to grant access to your APP in part 3)
5. In the Microsoft pop-up window that will be generated when you click on Consent, confirm the permission for "Graph Explorer".
6. Graph Explorer is ready to be used.
Part 2: Obtaining the site's ID (GET request)
1. Check if the HTTP method is set to GET (it is usually the default option).
2. In the main query bar, enter the URL, replacing the placeholders: https://graph.microsoft.com/v1.0/sites/{hostname}:/sites/{site-path}
-
{hostname}: Your company's host in SharePoint. Example:
yourcompany.sharepoint.com). -
{site-path}: Your site's name. Example:
sitename.
3. Click on Run query.
4. The Response preview window below will display a JSON. Copy the entire value of the ID field and save it somewhere. The value must follow this pattern: yourcompany.sharepoint.com,xxxx-xxxx-xxxx,yyyy-yyyy-yyyy.
Part 3: Granting permission to your application (POST request)
1. Change the HTTP method from GET to POST.
2. In the query bar, enter the new URL, replacing the {siteId} value with the recently copied ID: https://graph.microsoft.com/v1.0/sites/{siteId}/permissions
3. Below the query bar, click on the Request Headers tab.
4. Fill in the fields that will be displayed:
- In the
Keyfield, type:Content-Type - In the
Valuefield, type:application/json
5. Click on Add.
6. Click on the Request Body tab next to it.
7. Paste the following JSON to the text editor, replacing the placeholders with the data of the application you have created in the previous tab:
{
"roles": ["write"],
"grantedToIdentities": [
{ "application": {
"id": "<client-id-of-your-app>",
"displayName": "<name-of-your-app>"
}
}
]
}-
<client-id-of-your-app>: replace it with the "Application ID (client)" saved earlier. -
<name-of-your-app>: replace it with the name of your application. Example: “SoftExpert Document”.
8. Check that everything is correct (POST URL, Request Header, and Request Body) and click on Run query.
9. If all goes well, the 201 Created status will be shown, along with the JSON for the permission that has just been created, in the response window.
Setting up the integration in the Document component
1. Access the Configuration > General parameters (DC035) menu and go to the Microsoft 365 section.
2. Check the Enable editing with Microsoft 365 option.
3. Fill in the necessary fields:
| Tenant ID | Enter the directory (tenant) ID obtained from the application's properties in Microsoft Entra. |
| Site ID | Enter the ID of the configured Microsoft SharePoint site. |
| Client ID | Enter the application (client) ID obtained during the configuration of the application in Microsoft Entra. |
| Client Secret | Enter the client secret value obtained during the configuration of the application in Microsoft Entra. |
4. Check the Convert to PDF using Microsoft 365 option, if you wish. With this option checked, the system will use the integration with Microsoft 365 to convert the electronic files of documents to PDF, provided that PDF publishing is configured in the document category.
- The Microsoft 365 API is compatible with files in the following extensions: .doc, .docx, .odt, .xls, .xlsx, .xlsm, .ods, .ppt, .pptx, .pps, .ppsx, .potm, .odp, and .pdf.
- If there is a change of sites, the files will remain linked to the former site. In order not to loss information, make sure the documents are released before changing sites.
- When this API is used, features such as watermarks will not be applied.
- If the integration data happens to be edited, the documents with revisions in progress (which are stored temporarily in the site) will lose the changes.
Using Microsoft 365 to edit and view electronic files
1. Access the File > Document (DC003) menu or the Document (DC010) menu.
2. Locate and select the desired document.
3. Click on the
button to edit the electronic file; save the changes before exiting.
4. Click on the
button to view the electronic file.
- If the Double click electronic file to view it option is checked in the General tab of the general parameters, the files can also be viewed by double clicking on the document to which they belong. This option will not be available if the document status is "Issue".
- It is possible to view the electronic file quickly by clicking on the icon displayed in the EF column. If there is more than one electronic file associated with the document, a screen will be opened with a list of all associated electronic files. Click on the file you wish to view.
- In addition to the File > Document (DC003) menu, it is also possible to view or edit electronic files via Microsoft 365, from the menus below. In other menus, the file will be opened by the viewer configured in the Application tab of the general parameters.
- Execution > Revision (DC016).
- My tasks (Execution) > Document revision.
- My tasks (Tracking) > Revision tracking.
Conclusion
Thus, Microsoft 365 has been successfully integrated and electronic files can now be edited and viewed with the Office package.