Solved

programmatically print outlook attachments (server-side)

Posted on 2004-03-26
4
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

Question has a verified solution.

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

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

738 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