OneDrive Feature Activation
K2 integrates with Microsoft OneDrive through SmartObjects. To enable integration between K2 and OneDrive, activate an instance of the OneDrive feature.
-
You must be a K2 administrator to activate features in K2 Management.
-
Enable your cloud storage feature activations. Follow the steps in K2 Cloud Storage.
- An active OneDrive 'personal' account.
Create a new OneDrive service instance by using the OneDrive feature activation. You can create multiple instances of the same feature. If you have more than one OneDrive account, you can create an instance for each one.
- Browse to the Features page in K2 Management.
- Select the OneDrive feature and click New Instance.
- Specify a name and description for your new OneDrive instance.
- Click Add.
- The configuring page shows the progress of the new instance configuration.
- During the Get OAuth Token step, you see the Microsoft login page open in a new browser tab. Specify your username and click Next.
- Specify your password and click Sign in.
- Close the login page when you see the Authorization Successful message. If you do not see this page, your username and password may be incorrect.
. - Click Continue. If authorization succeeds the service instance is created.If not, the login page opens again and you can try a different Microsoft username and password.
- Your OneDrive integration is ready to use once the Registering Service Instance step is finished.
- Click Done to close the page.
Cloud storage SmartObjects use OAuth tokens to authenticate with your cloud storage provider. Use the following authentication details to plan the behavior you need in your K2 applications:
- Workflows: When a cloud storage SmartObject method is executed without user context, such as in a SmartObject step in a workflow, the account used during Feature Activation is used to access the cloud storage provider and uses the OAuth token created during Feature Activation. See How To: Use a workflow as an intermediary to upload a file from a form to cloud storage for an example of this approach.
- SmartForms: When a cloud storage SmartObject method is executed with user context, such as in a SmartForm, the person using the form must login with their cloud storage credentials which creates an OAuth token. In this case, they have access to their own personal files and folders. See How To: Upload a file to Google Drive with a SmartForm for an example of this approach.
- If your SmartForm needs the contents of the account used during Feature Activation, every person using the form must login with that account.
- If your SmartForm needs the cloud storage contents of the person using the SmartForm, every person using the form must login with their own account.
In most cases you should use cloud storage SmartObjects methods from a workflow so that the same cloud drive is used. When using cloud storage SmartObjects with SmartForms, you can start a workflow with a button or rule to execute SmartObject methods. Only use a direct cloud storage SmartObject method in a SmartForm if you need a folder or file from the cloud storage account of the person using the SmartForm.
- If errors occur during the configuration, the Retry button is enabled. Leave the browser tab open and, after solving the issue, click the Retry button to continue the configuration.
- When uploading a file with the File SmartObject, you must specify the full path (including the file name and extension) in the Path property to upload the file.
- When downloading a file with the File SmartObject, you must specify the full path (including the file name and extension) in the Path property for the file you want to download.
- Using a back slash (\) in your feature name creates nested categories in the Cloud Storage folder for the instance. For example, Finance\Invoices creates Finance > Invoices and not as expected,Finance\Invoices.
- The feature activation creates three SmartObjects, File, Folder, and Service. For more information about these SmartObjects see Cloud Storage service type.
- For Upload and Copy file methods, if the destination path does not exist, it is created for you.
- You get an “Illegal characters in path” error message when you upload or download a file containing special characters in the file name or folder path name, including characters that Windows does not allow such as \/:*?"<>|.
- All methods append a leading forward slash for the value you provide in the path input property
- The List Folder Contents method supports paging, however filtering may not work as expected because filtering is performed after paging, therefore only results in the first page are filtered.
- Page size defaults to 200 entries.
- You do not need to add the trailing forward slash to paths (it is added for you when missing)
- Box and Google Drive make use of the Tags property when retrieving and updating metadata. Other storage providers either do not make use of this property or have limited support for it.
- To remove all tags from a file or folder, use the UpdateTags method and pass two empty strings "","".
- When you use the List Contents or Search SmartObject methods in SmartForms, do not select Edit all Rows or enable Add new row link since you cannot update or add new records using these methods.
- There is no Rename method or function in the SmartObjects, but you can effectively rename a file using the Move method.
- The OneDrive Feature does not support OneDrive for Business. If you are using OneDrive for Business, you can use K2 for SharePoint instead, since OneDrive for Business 'folders' are actually SharePoint libraries.
- OneDrive supports a maximum of 128 characters for object names.
- Your entire path, including the file name, must contain fewer than 400 characters.
- OneDrive does not allow file names with a trailing "." character.
- OneDrive has limited support for special characters. The following are considered invalid: " * : < > ? / \ | ". See Invalid file names and file types in OneDrive, OneDrive for Business, and SharePoint. for more information.
- OneDrive does not support copying folders.
- OneDrive does not support searching for a specific folder. The search method searches your entire OneDrive.
- You may receive an error message when using the GetInfo method of the Folder or File SmartObjects on the root folder "/". The error message says "An Error Has Occurred. One or more services for this method errored. Error Message: Invalid path. Paths must begin with a '/' and end with the name of the resource".