Plumtree EDK (Enterprise Web Development Kit) 5.4.0

IDocumentManager.CreateRemoteDocument Method (Int32, Int32, String)

Creates a new remote document.

IRemoteDocument CreateRemoteDocument(
   int parentFolderID,
   int dataSourceID,
   string location
);

Parameters

parentFolderID
the ID of the directory folder in which to create the new document
dataSourceID
the ID of the Data Source associated with the new document
location
the location string that will be passed to the remote crawler to indicate which document to retrieve. Further notes on location: this is the same value which would be returned in the location field of Plumtree.Remote.Crawler.ChildDocument and then passed to the DataSource in Plumtree.Remote.Crawler.IDocumentProvider#AttachToDocument. The location string could be a full path for a file crawler; a concatenation of schema, table name, and primary key for a database crawler; a concatenation of database name, view name, and document unique id for a Notes crawler; or a application-specific string for a custom crawler.

Sample code to create a fictitious remote document
//get the document manager.....
int folderID = 20; //get from the query string from mousing over the directory folder in the ui
int dataSourceID = 30; //get from the query string from mousing over the data source in the ui
//location of a file; the format of the location string is data-source specific
String location =  "\\\\MyServer\\share\\Portlet FAQ and Price list.doc"  ;
IRemoteDocument doc = documentManager.CreateRemoteDocument(folderID, dataSourceID, location);
//set the override name and description- otherwise the value would be taken from the accessor
doc.SetOverrideName("Portlet Price List");
doc.SetOverrideDescription("Portlet Prices and FAQs");
//set the type- in this case, a word doc in the MIME namespace
doc.SetType("http://www.plumtree.com/dtm/mime", "application/msword");
//set the docID to a negative number to check for failure
int docID = -1;
try
{
  docID = documentManager.save();
}
catch (System.Web.HttpException e)
{
 //if the query interface URL was not valid
 Console.WriteLine(e.StackTrace);
}
catch (PortalException pe)
{
 //if the operation resulted in an error in the portal
 Console.WriteLine(pe.StackTrace);
}
//process docID as desired......

Return Value

the new document

Remarks

The document will not be saved in the portal Knowledge Directory until the Save() method is called on the IDocument object. See DatasourceID enumeration for a list of predefined datasources.

See Also

IDocumentManager Interface | Plumtree.Remote.PRC Namespace | IDocumentManager.CreateRemoteDocument Overload List