SharePoint OData Connector 24.1

# Insert an Attachment

To insert an attachment to a list item, the `insertXml` must include the following properties.

`TYPE` | The type of item to insert. To insert an attachment, specify `ATTACHMENT`.
`FILENAME` | The file name of the attachment.

You must then specify either (`LISTITEMID`, `LISTID`, `SITEID`, and `SITECOLLECTIONURL`) or (`INSERTFROMPATH`, `SITEURL`, `LISTNAME`, and `PATH`).

`INSERTFROMPATH` | To insert an attachment by path, set this to `TRUE`.
`LISTID` | The GUID of the list to which you want to add the attachment.
`LISTITEMID` | The integer ID of the list item to which you want to add the attachment.
`LISTNAME` | The name of the list to which you want to add the attachment.
`PATH` | The full path to the list item, including the list item name, relative to the root of the list.
`SITECOLLECTIONURL` | The absolute URL of the site collection to which you want to add the attachment.
`SITEID` | The GUID of the site to which you want to add the attachment.
`SITEURL` | The absolute URL of the site to which you want to add the attachment.

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

    <insertXML>
      <insert>
        <reference>TEST_ATTACHMENT</reference>
        <property name="TYPE" value="ATTACHMENT"/>
        <property name="FILENAME" value="myattachment.file"/>
        <property name="LISTITEMID" value="125"/>
        <property name="LISTID" value="26FFE115A45AF1F1"/>
        <property name="SITEID" value="E11526FFA45AF1F1"/>
        <property name="SITECOLLECTIONURL" value="http://sharepoint/SiteCollection/"/>
        <file>
          <type>file</type>
          <content>e:\my_files\myfile.doc</content>
        </file>
      </insert>
    </insertXML>

To insert an attachment by path, your XML might look like this:

    <insertXML>
      <insert>
        <reference>TEST_ATTACHMENT</reference>
        <property name="TYPE" value="ATTACHMENT"/>
        <property name="FILENAME" value="myattachment.file"/>
        <property name="PATH" value=" folder/subfolder/item1"/>
        <property name="LISTNAME" value="MyList"/>
        <property name="SITEURL" value="http://sharepoint/SiteCollection/Site/"/>
        <property name="INSERTFROMPATH" value="TRUE"/>
        <file>
          <type>content</type>
          <content>[The entire file base64 encoded]</content>
        </file>
      </insert>
    </insertXML>

Copyright 2023 Open Text
Version 24.1 | Last updated December 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL SharePoint OData Connector 24.1

Topic Title: Insert an Attachment