home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
CHIPCD_3_98.iso
/
software
/
testsoft
/
exchange
/
webdata
/
usa
/
lib
/
attach.inc
< prev
next >
Wrap
Text File
|
1997-08-25
|
4KB
|
115 lines
<%
'!--Microsoft Outlook Web Access-->
'!--Attach.inc - File Upload Functions-->
'!--Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.-->
'==========================================================================
' GetWebTempDirectory
' Returns the directory where the exupload.dll deposits the file
'==========================================================================
Public Function GetWebTempDirectory()
On Error Resume Next
Set objRenderApp = Application( bstrRenderApp )
bstrSaveDirectory = objRenderApp.ConfigParameter("RFC1867SaveDirectory")
Set objRenderApp = nothing
GetWebTempDirectory = bstrSaveDirectory
End Function
'===========================================================================
' DeleteAttachments - Deletes attachments from attachment collection in msg
' bstrUrlDelete - Delete parameter from url delimeted by semicolons
' Example: delete=1;3 attachments 1 and 3 will be deleted
' objAttachColl - Active Messaging attachment collection
'===========================================================================
Public Sub DeleteAttachments(bstrUrlDelete, objAttachColl)
On Error Resume Next
'url format = ;#;#;#;#
start=1
pos=1
leng=1
totlen=len(urlDelete)
do until pos >= totlen
start = pos + 1
fin=instr(start,urlDelete,";")
if fin = 0 then fin = len(urlDelete) + 1
leng = fin - start
x = cint(mid(urlDelete,start,leng))
objAttachColl.item(x).delete
pos = fin
loop
End Sub
'==========================================================================================
' GetFileName - Returns the file name from the file path provided by exupload.dll
'==========================================================================================
Public Function GetFileName(bstrFilePath)
On Error Resume Next
fd = "\"
isoffset = 0
if isUNIX() then
fd="/"
elseif isMac() then
fd=":"
end if
pos = instrRev(ffname, fd, len(ffname))
bstrFileName = Mid(ffname, pos + 1, len(ffname) - pos - 1)
'Check for quote in first character.
If Left(bstrFileName,1) = chr(34) then
bstrFileName = Right(bstrFileName, Len(bstrFileName) - 1)
End If
GetFileName = bstrFileName
End Function
'==========================================================================================
' GetFileExt - Returns the file extension from the file name provided by exupload.dll
'==========================================================================================
Public Function GetFileExt(bstrFileName)
On Error Resume Next
pos = instrRev(ffname, ".", len(ffname))
filestart=1
GetFileExt = Mid(ffname,pos, len(ffname) - pos)
End Function
'==========================================================================================
' AddAttachment
' objMsg - Active Messaging message object
' bstrTempFileName - Temp file name returned from exupload.dll
' bstrMimeType - Mime Type returned from exupload.dll
' bstrFilePath - File path returned from exupload.dll
'==========================================================================================
Public Function AddAttachment(objMsg, bstrTempFileName, bstrMimeType, bstrFilePath)
On Error Resume Next
Set objAttachColl = objMsg.Attachments
bstrTempFilePath = GetWebTempDirectory + "\" + bstrTempFileName
bstrFileName = GetFileName(bstrFilePath)
Set objAttach = objAttachColl.Add(bstrFileName,1,,bstrTempFilePath)
'Create a text file of the same name and close it. This code writes a 0 byte file over the
'file that was just uploaded.
Set fs = CreateObject("Scripting.FileSystemObject")
Set tmp = fs.CreateTextFile(bstrTempFilePath, True)
tmp.close
objAttach.Source = bstrFileName
Set objFields = objAttach.Fields
objFields.Item(ActMsgPR_DISPLAY_NAME) = bstrFileName
objFields.Item(ActMsgPR_ATTACH_MIME_TAG) = bstrMimeType
objFields.Item(ActMsgPR_ATTACH_TAG) = "2A864886F714030A04"
objFields.Item(ActMsgPR_ATTACH_EXTENSION) = GetFileExt(bstrFileName)
Set objFields = Nothing
Set AddAttachment = objAttach
End Function
%>