Insert Information into OneDrive

The connector's insert fetch action inserts information into OneDrive.

To use the insert action, you must construct some XML that specifies where to add each item, and the information to insert. You must add the XML to the action as the value of the insertXML action parameter. The exact structure of the XML depends on the type of item that you want to insert.

The XML contained in the insertXml parameter must be URL encoded before being used in the action command. For example:

http://host:port/action=Fetch&FetchAction=Insert
                             &ConfigSection=MyTask
                             &InsertXML=[URL encoded XML]

For more information about using the insert fetch action, refer to the OneDrive Connector Reference.

Insert a Folder

To insert a folder in OneDrive, your XML must include the following properties:

ONEDRIVE_PARENT_ID The ID of the parent folder in which you want to insert the new folder. You can find the ID for existing folders in documents retrieved by the synchronize fetch action.
ONEDRIVE_USER_ACCOUNT_ID The OneDrive user account ID.
ONEDRIVE_NAME The name of the new folder.
ONEDRIVE_TYPE The type of item to insert into OneDrive. Set this property to folder.
ONEDRIVE_DESCRIPTION The folder description.

For example, the value of your insertXML action parameter might look like this:

<insertXML>
  <insert>
    <reference>My Reference</reference>
    <property name="ONEDRIVE_PARENT_ID" value="folder.9d6007287fc386c5.9D6007287FC386C5"/>
    <property name="ONEDRIVE_USER_ACCOUNT_ID" value="9d6007287fc386c5"/>
    <property name="ONEDRIVE_NAME" value="newfolder"/>   
    <property name="ONEDRIVE_TYPE" value="folder"/>
    <metadata name="ONEDRIVE_DESCRIPTION" value="my new folder"/> 
  </insert>
</insertXML>

Insert a File

To insert a file into OneDrive, your XML must include the following properties:

ONEDRIVE_PARENT_ID The ID of the parent folder in which you want to insert the file. You can find the ID for existing folders in documents retrieved by the synchronize fetch action.
ONEDRIVE_USER_ACCOUNT_ID The OneDrive user account ID.
ONEDRIVE_NAME The name of the new file that is created in OneDrive.

For example, the value of your insertXML action parameter might look like this:

<insertXML>
  <insert>
    <reference>My Reference</reference>
    <property name="ONEDRIVE_PARENT_ID" value="folder.9d6007287fc386c5.9D6007287FC386C5"/>
    <property name="ONEDRIVE_USER_ACCOUNT_ID" value="9d6007287fc386c5"/>
    <property name="ONEDRIVE_NAME" value="newfile.txt"/>
    <file>
      <type>file</type>
      <displayname>newfile.txt</displayname>
      <content>C:\Path\To\My\NewFile.txt</content>
    </file>
  </insert>
</insertXML>