/ Forums / Advansys Formativ / Free Solutions from GroupWise Cool Solutions or Advansys / Warning user of attachment size they are sending / Reply To: Warning user of attachment size they are sending
August 7, 2006 at 7:48 am
#8317
Hi,
Just so you know we hacked around the attachment checker example and came up with the code below. Its quick and dirty but it appears to do the job:
'1000000 = 1mb, 20000000 = 20mb Const miWarnSize = 20000000 sub Main(Client, GWEvent) Dim Msg Set Msg = GroupWise.ComposingItem if Msg is Nothing then on error resume next Set Msg = Client.ClientState.CommandMessage if not Msg is Nothing then CheckAttachments(Msg.MessageID) end if else CheckAttachments(Msg.MessageID) end if Set Msg = nothing end Sub Sub CheckAttachments(MessageID) Dim msName Dim msSize for x = 0 to groupwise.ItemAttachmentGetCount("X00") -1 msName = groupwise.ItemAttachmentGetName("X00", x) if msName <> "" then Do Until InStr(1, msName, "") = 0 msName = Mid(msName, InStr(1, msName, "") + 1) Loop end if miSize = Utilities.FileSystem.GetSizeOfFile(groupwise.ItemAttachmentGetName("X00", x)) msSize = cstr(round(miSize/1000000)) if Utilities.FileSystem.GetSizeOfFile(groupwise.ItemAttachmentGetName("X00", x)) > miWarnSize then CancelSendDlg.CancelSendDlgLabel1.Caption = "The size of attachment " + msName + " is really large @ " + msSize + "mb are you sure you want to send it?" GroupWise.CancelGroupWiseEvent = CancelSend end if next end sub ' Ask the user if they want to cancel the sending of the item. Return a boolean ' indicating if they wish to cancel or not. function CancelSend CancelSend = CancelSendDlg.ShowModal = MRCancel end function