Solved

programmatically print outlook attachments (server-side)

Posted on 2004-03-26
4
506 Views
Last Modified: 2010-03-05
Is it possible to programmatically print outlook attachments (server-side) for an email account?
0
Comment
Question by:froggy_bill
  • 2
4 Comments
 
LVL 1

Expert Comment

by:ktuffner00
ID: 10691502
you can by creating a sript or by using a third party tool to do this, but ive never done it.  check the microsoft newsgroups for exchange or slipstick.com.  Im sure someone has done it.  The best would be a script in my way.  Ive also heard from other people in the field about third party software that does this
0
 
LVL 10

Expert Comment

by:OneHump
ID: 10691744
You definately would have to program.  I think the the operative term here is "server side".  The only way to do this server side is by running the app, along with a MAPI subsystem (client) on the server.  That may not be desireable for performance reasons.  You could definately run your app against the server from a remote location.

You can definately do this though.  The best approach would be one of two things:

1.  An event script that hooks into a print control.

2.  A VB script or application that uses a MAPI control to pull down messages, place them into an array and print using a print control.

None of this is hard.  The hard part is doing this if you don't know VB or VBScript.

OneHump
0
 
LVL 2

Expert Comment

by:timiano
ID: 10712974
Dim Rec
Dim Rs
Dim strURL
Dim strQ
Dim strSubj
Dim DomainName
Dim strLocalPath
Dim UnreadCount

Set Rec = CreateObject("ADODB.Record")
Set Rs = CreateObject("ADODB.Recordset")

DomainName = "domain.internal"
strUser = "usernam"
strPwd = "password"

strLocalPath = "MBX/" & strUser & "/inbox"

strURL = "file://./backofficestorage/" & DomainName & "/" & strLocalPath
'Response.Write "strURL= " & strURL


Rec.Open strURL,,,,,strUser,strPwd

' Build the SQL query for the messages.
strQ = "select "
strQ = strQ & " ""urn:schemas:mailheader:date"""
strQ = strQ & ", ""urn:schemas:httpmail:to"""
strQ = strQ & ", ""urn:schemas:httpmail:from"""
strQ = strQ & ", ""urn:schemas:mailheader:subject"""
strQ = strQ & ", ""urn:schemas:mailheader:received"""
strQ = strQ & ", ""urn:schemas:httpmail:read"""
strQ = strQ & ", ""DAV:contentclass"""
strQ = strQ & ", ""DAV:href"""
strQ = strQ & " from scope ('shallow traversal of "
strQ = strQ & Chr(34) & strURL & Chr(34) & "')"
'strQ = strQ & " WHERE ""urn:schemas:httpmail:hasattachment"" = true"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\TextFileToLogOutputTo.log")

' Open the recordset.
Rs.Open strQ, Rec.ActiveConnection

Rs.MoveFirst
Unreadcount = 0

' Loop through all of the messages in the recordset and format them in a table.
Do Until Rs.EOF

objFile.WriteLine Rs.Fields("urn:schemas:httpmail:from").Value & "," & _
      Rs.Fields("urn:schemas:httpmail:to").Value & _
      Rs.Fields("urn:schemas:mailheader:subject").Value & _
      Rs.Fields("urn:schemas:mailheader:date").Value & _
      Rs.Fields("urn:schemas:mailheader:date").Value & _
      Rs.Fields("DAV:contentclass").Value & _
      Rs.Fields("DAV:href").Value
Rs.MoveNext


' Close the record and recordset.
Rs.Close
Rec.Close

You have to use this logged on as the particular user, or as a user with full mailbox access to the account in question.  This will output to a text file that you specify.  I have used this for other purposes before, but with different criteria.  http://msdn.microsoft.com/library/en-us/cdosys/html/_cdosys_schema_httpmail.asp explains the rest of the fields that can be accessed via ADO/CDO.

Timiano
0
 
LVL 2

Accepted Solution

by:
timiano earned 500 total points
ID: 10712978
Oh, and take out the  ' I put on the line with the hasattachment query.....sorry!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
This video discusses moving either the default database or any database to a new volume.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now