Ok. Remember. The file is being uploaded. It is NOT yet uploaded. Thats why I was originally using CMS.CustomEventHandler.CustomDataHandler. I am catching the event prior to the upload point.
Inside CustomTreeNodeHandler.OnBeforeInsert the GUID is not valid.
Inside CustomTreeNodeHandler.OnAfterInsert there is a NodeGUID but using it to extract AttachmentInfo returns a null. In any case, using FileAttachment returns a null or an empty GUID.
This code is executed inside CustomTreeNodeHandler.OnAfterInsert when the SAVE button is clicked.
Guid nodeguid = (Guid)node.GetValue( "FileAttachment", Guid.Empty );//always empty
if ( nodeguid != Guid.Empty )
{
AttachmentInfo fileinfo = CMS.WorkflowEngine.DocumentHelper.GetAttachment( nodeguid, treeprov, node.NodeSiteName );
if ( fileinfo != null )
{
string filesize = fileinfo.AttachmentSize.ToString();
string filetype = fileinfo.AttachmentExtension;
}
}
Here is the node contents handed in by the event.
node {CMS.TreeEngine.TreeNode} CMS.TreeEngine.TreeNode
ColumnNames {string[88]} string[]
CoupledClassIDColumn FileID string
DataRow {System.Data.DataRow} System.Data.DataRow
DocumentCampaign string
DocumentCheckedOutVersionHistoryID 0 int
DocumentContent {CMS.TreeEngine.EditableItems} CMS.TreeEngine.EditableItems
DocumentCulture en-US string
DocumentCustomData {CMS.GlobalHelper.CustomData} CMS.GlobalHelper.CustomData
DocumentExtensions string
DocumentID 212345 int
DocumentMenuCaption string
DocumentMenuClass string
DocumentMenuClassHighlighted string
DocumentMenuClassOver string
DocumentMenuItemImage string
DocumentMenuItemImageHighlighted string
DocumentMenuItemImageOver string
DocumentMenuItemInactive FALSE bool
DocumentMenuItemLeftImage string
DocumentMenuItemLeftImageHighlighted string
DocumentMenuItemLeftImageOver string
DocumentMenuItemRightImage string
DocumentMenuItemRightImageHighlighted string
DocumentMenuItemRightImageOver string
DocumentMenuJavascript string
DocumentMenuRedirectUrl string
DocumentMenuStyle string
DocumentMenuStyleHighlighted string
DocumentMenuStyleOver string
DocumentName 250px-Gallo-Roman_4th_century_shield_boss string
DocumentNamePath /Where We Build/Texas/Temple/Waco/Temple/Waco/Killeen/Windmill Farms/Plans/The Columbus/Floorplan/250px-Gallo-Roman_4th_century_shield_boss string
DocumentPageTemplateID 0 int
DocumentPriority 0 int
DocumentPublishFrom {1/1/0001 12:00:00 AM} System.DateTime
DocumentPublishTo {12/31/9999 11:59:59 PM} System.DateTime
DocumentRatings 0 int
DocumentRatingValue 0 double
DocumentStylesheetID -1 int
DocumentTagGroupID 0 int
DocumentTags string
DocumentUrlPath string
DocumentUseCustomExtensions FALSE bool
DocumentUseNamePathForUrlPath FALSE bool
DocumentWildcardRule string
HasChanged TRUE bool
HasSKU FALSE bool
IsArchived FALSE bool
IsCoupled TRUE bool
IsInPublishStep TRUE bool
IsLink FALSE bool
IsPublished TRUE bool
IsSecuredNode -1 int
mClassName CMS.File string
mColumnNames {string[88]} string[]
mCoupleClass {CMS.DataEngine.SimpleDataClass} CMS.DataEngine.IDataClass {CMS.DataEngine.SimpleDataClass}
mDataRow {System.Data.DataRow} System.Data.DataRow
mDocumentClass {CMS.DataEngine.SimpleDataClass} CMS.DataEngine.IDataClass {CMS.DataEngine.SimpleDataClass}
mDocumentContent {CMS.TreeEngine.EditableItems} CMS.TreeEngine.EditableItems
mDocumentCustomData {CMS.GlobalHelper.CustomData} CMS.GlobalHelper.CustomData
mNodeCustomData {CMS.GlobalHelper.CustomData} CMS.GlobalHelper.CustomData
mOriginalDocumentExtensions string
mOriginalDocumentName 250px-Gallo-Roman_4th_century_shield_boss string
mOriginalDocumentTags string
mOriginalDocumentTagsGroup 0 int
mOriginalDocumentUrlPath string
mOriginalNodeAlias 250px-Gallo-Roman_4th_century_shield_boss-(2) string
mOriginalNodeAliasPath /Where-We-Build/Texas/Temple-Waco-Killeen/Temple-Waco-Killeen/Windmill-Farms/Plans/Columbus/Floorplan/250px-Gallo-Roman_4th_century_shield_boss-(2) string
mOriginalNodeLevel 9 int
mOriginalNodeName 250px-Gallo-Roman_4th_century_shield_boss (2) string
mOriginalNodeParentID 108029 int
mOriginalNodeSKUID 0 int
mOriginalSiteID 2 int
mOriginalValuesLoaded TRUE bool
mSKUClass null CMS.DataEngine.IDataClass
mTreeClass {CMS.DataEngine.SimpleDataClass} CMS.DataEngine.IDataClass {CMS.DataEngine.SimpleDataClass}
mTreeProvider {CMS.TreeEngine.TreeProvider} CMS.TreeEngine.TreeProvider
mWorkflowStepName string
NodeAlias 250px-Gallo-Roman_4th_century_shield_boss-(2) string
NodeAliasPath /Where-We-Build/Texas/Temple-Waco-Killeen/Temple-Waco-Killeen/Windmill-Farms/Plans/Columbus/Floorplan/250px-Gallo-Roman_4th_century_shield_boss-(2) string
NodeBodyElementAttributes string
NodeCacheMinutes -1 int
NodeChildNodesCount 0 int
NodeClassName CMS.File string
NodeCustomData {CMS.GlobalHelper.CustomData} CMS.GlobalHelper.CustomData
NodeDocType string
NodeGUID {caa3242d-73d0-4265-b841-5784c44787a2} System.Guid
NodeHeadTags string
NodeID 189045 int
NodeInheritPageLevels string
NodeLevel 9 int
NodeName 250px-Gallo-Roman_4th_century_shield_boss (2) string
NodeOrder 3 int
NodeOwner 6756 int
NodeParentID 108029 int
NodeSiteID 2 int
NodeSiteName DRHorton string
NodeSKUID 0 int
OriginalNodeID 189045 int
PublishedVersionExists TRUE bool
RequiresSSL -1 int
SearchType cms.document string
TreeProvider {CMS.TreeEngine.TreeProvider} CMS.TreeEngine.TreeProvider
WorkflowStepName string
Static members
There is no FileAttachment entry there.
Thanks.