# Insert a Stub into the SharePoint Repository

Some applications move or archive documents. In place of the original document they can leave a stub, which points to the new location. If the original document is requested, an application instead finds the stub. The stub contains the name of a connector group that can access the document in the new location, and the document's new identifier. The application can then send this information to a Distributed Connector, which queries a suitable connector to retrieve the document from its new location.

The stub fetch action works in a similar way to the insert action. To insert a stub, you must construct some XML that specifies how and where to add the stub. You must add the XML to the action as the value of the `stubXML` action parameter. The exact structure of the XML depends on the information required to insert items into the repository.

You can insert a stub into SharePoint as one of the following types:

- `FILE`. When inserting the stub into a document library, the document library must support the "Link to a Document" content type.
- `LISTITEM`. The list must support the "Link" content type.
- `ATTACHMENT`.

The properties that you must set for inserting the stub are the same as for inserting a document with the insert action. For example, to insert a stub as a list item, you could use the following XML:

    <stubXML>
       <stub>
         <property name="TYPE" value="LISTITEM"/>
         <property name="INSERTFROMPATH" value="TRUE"/>
         <property name="SITEURL" value="http://sharepointhost/site/"/>
         <property name="LISTNAME" value="listname"/>
         <property name="PATH" value="/folder1/folder2/listitemname"/>
         <target>
           <uri>http://host/target</uri>
         </target>
       </stub>
     </stubXML>

For information the properties you must set, see Insert a File, Insert a List Item, or Insert an Attachment. The `target` element contains information about the new location of the document. The URI could be the URI to a Distributed Connector.

The XML contained in the `stubXml` parameter must be URL encoded. For example:

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

For more information about using the `stub` fetch action, refer to the SharePoint Remote Connector Reference.

_FT_HTML5_bannerTitle.htm