Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

programmatically print outlook attachments (server-side)

Posted on 2004-03-26
4
Medium Priority
?
540 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 2000 total points
ID: 10712978
Oh, and take out the  ' I put on the line with the hasattachment query.....sorry!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Stellar Exchange Toolkit: this 5 in 1 toolkit comes loaded with mega-software tool. Here’s an introduction to tools’ usage and advantages:
Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
In this video we show how to create an email address policy 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 Mail Flow…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses
Course of the Month20 days, 19 hours left to enroll

810 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