Hey so we got it working, wasn’t too hard really. Can drag out of Epicor to Explorer, Outlook, or even to other Epicor screens. We’re not professional coders though… so if someone spots an issue or security vulnerability please holler.
//below needed for drag-drop out
using Ice.Lib.Framework.JobLib;
using Infragistics.Win.UltraWinTree; //added to allow SingleAutoDrag
using System.IO;
...
// Add Drag-drop OUT of tree (for eg Procurement to drag drawings to desktop or to an email
private void jobTree_SelectionDragStart(object sender, EventArgs e) { //sender should be a JobTreeNode
MethodTree methodTree = sender as MethodTree;
JobTreeNode jobTreeNode = methodTree.LastJobNode as JobTreeNode; //"LastJobNode" is last clicked on node, this is the node we're dragging from
//Only run this on attachment nodes
if (jobTreeNode.IsAttachmentNode) {
string[] filePaths = new string[1]; //needs to be an array for the DataObject FileDrop variable initialization
//Get attachment filepath
foreach (DataRowView dataRowView in jobTreeNode.EpiDataView.dataView) {
if ((string)dataRowView["SysRowID"].ToString() == jobTreeNode.NodeKey) {
filePaths[0] = dataRowView["filename"].ToString();
break;
}
}
DataObject data = new DataObject(DataFormats.FileDrop, filePaths); //dragdop needs a dataobject with filepath array
data.SetData(DataFormats.StringFormat, filePaths[0]); //Set filepath
methodTree.AllowDrop = false; //prevent copying the attachment file into this same tree
methodTree.DoDragDrop(data, DragDropEffects.Copy); //Do the dragdrop - works in explorer, outlook, etc.
methodTree.AllowDrop = true; // reenable drag-drop into this tree
}
}