Hello all
I am trying to modify a CDO script that moves email messages out of a user's inbox and into a drop folder. I want to update it to use a Public Folder instead.
The portion of the original script that matters is: -
' URL used for Outlook Web Access
-
strOWAURL = "http://servername/exchange/"
-
-
' Login
-
-
Set objUserSess = CreateObject("MAPI.Session")
-
objUserSess.Logon , , , , , , strServerName & vbLF & strAccountName
-
-
' Move each message
-
-
Set objFolder = objUserSess.Inbox
-
For each objMsg in objFolder.Messages
-
for each strMsgField in objMsg.fields
-
if instr(strMsgField,"/Inbox/") > 0 then
-
set objWebMsg = createobject("CDO.Message")
-
objWebMsg.datasource.open strOWAURL& strMailBoxName & strMsgField
-
set stm = objWebMsg.getstream()
-
stm.type = 2
-
stm.Charset = "x-ansi"
-
rfcmsg = stm.readtext
-
rfcmsg = "x-sender: " & objWebMsg.fields("urn:schemas:httpmail:from") & vbcrlf & rfcmsg
-
rfcmsg = "x-receiver: " &strListEmail & vbcrlf & rfcmsg
-
stm.position = 0
-
stm.writetext = rfcmsg
-
stm.savetofile strPickupFolder & objMsg.ID & ".eml"
-
end if
-
next
-
objMsg.Delete
-
next
-
My modified script is: -
' URL used for Outlook Web Access
-
strOWAURL = "http://localhost/public/testfolder/"
-
-
Set objSession = CreateObject("MAPI.Session")
-
objSession.Logon , , , , , , strServerName & vbLF & strAccountName
-
-
' Change from a user inbox to the Public Folder infostore
-
-
Set objInfoStores = objSession.InfoStores
-
Set objInfoStore = objInfoStores.Item("Public Folders")
-
Set objRootFold = objInfoStore.RootFolder
-
-
Set objFolder = objRootFold.Folders(2).Folders("TestFolder")
-
-
For each objMsg in objFolder.Messages
-
for each strMsgField in objMsg.fields
-
-
' deleted line if instr(strMsgField,"/Inbox/") > 0 then
-
' couldn't see the relevance in a Public Folder
-
' with no subfolders
-
-
set objWebMsg = createobject("CDO.Message")
-
-
' this is the line that doesn't work below
-
' the error is that it can't find the message
-
-
objWebMsg.datasource.open strOWAURL & strMsgField
-
So my question is, how can I open the message with the datasource.open method, given that we are now talking about a message object in a public folder, not a user's inbox?
I'm totally new to VB, so if I have made some outrageous and/or idiotic error, then I am not surprised (and I apologise in advance!).
Thanks for your help.
0 3464 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Oleg Safronov via .NET 247 |
last post by:
I'm trying to read properties of journal item which is stored in Exchange public folder.
I already have access to journal item via CDO.Item object.
However, it does not allow reading of properties specific for journal and there is no object in CDO model designed for journal items :(
I have found the Redemption library that allow reading of any MAPI properties.
However, it uses Outlook and MAPI objects as input.
How can I get a...
|
by: Neil Ginsberg |
last post by:
I am using VBA/Access to send SMTP mail using CDO. I set a reference to
"Microsoft CDO for Windows 2000 Library" (cdosys.dll). Everything works
fine, both on my PC and on another PC. However, on another PC that the
database was installed on, the user is getting the message, "The project
contains a missing or broken reference to the file 'CDO.DLL' version 1.21."
However, I don't have a reference to cdo.dll; my reference is to cdosys.dll....
|
by: Chad Myers |
last post by:
I'm looking for an app that would allow me to
download mails from various POP3 accounts and
put them into my Exchange inbox on the server
side (rather than having to have outlook open
to do it all the time).
There are many products that do this, but
they're very expensive considering it's just
for me and just for tinkering.
|
by: Noonan, Derek |
last post by:
Hi all,
I'm reposting this, as I feel that it may have got buried. If anyone can
help me then I'd really appreciate it...
I am trying to read information from the GAL using C#. I am able to return a
list of all the addresses and names, however, when I walk through each
address I cannot access the mailbox (I keep getting prompted for
authentication information). Given that the long-term goal here is that the
application run unattended...
|
by: Ripley |
last post by:
I have seen this article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_hosting_createpublicfolder.asp
I can't seem to make the conversion to C# - I don't see how to even do
something as simple as create a new folder object. The intellisense after
"CDO." doesn't seem to provide that.
More importantly, I need to know if it is possible to have this code (or
some code that works) NOT reside on the exchange...
| |
by: |
last post by:
How can I force SmtpMail class to use CDO for Windows 2000 instead of
Exchange 2000. We do not use Exchange at all. I want to do this because I
am having a problem sending email from the web server. If I send part of
the HTML email it will go through. If I send the whole HTML email then it
gets stuck on our email server at corporate with the error:
The message could not be sent to the SMTP server. The transport error code
was...
|
by: Pieter |
last post by:
Hi,
I'm using a thight integration with Outlook 2003 (with an Exchange server)
in my VB.NET (2005) application.
Until now I'm using the Outlook Object Model, but it appears to be very
slow, and has some problems:
- doing a Move changes the ReceivedTime of the MailItem
- I can't use RichText in the MailItem.Body (only allows plain text or HTML)
- some other stuff like having to use small 'tricks' to show the default
signature in an email
|
by: Steve Smith |
last post by:
I have written a winforms application that launches approximately 150
threads with
Thread.ThreadStart()
Each thread uses CDO 1.21 to logon to a different Exchange mailbox and
send/receive a number of mail messages, reporting back to the UI thread
through the use of a Queue object. When all messages that are expected have
been received, each thread sends a final update to the UI and the method
should exit, which should terminate the...
|
by: anup wadekar |
last post by:
I am able to access the exchange mail boxes of the mounted edb file using Active Directory Services such that i am retrieving the
names of the user's and than setting the mail box to the user.
CDO.Message objMsg;
CDO.DropDirectory objDropDir = new CDO.DropDirectory();
CDO.IMessages objIMesgs;
DirectoryEntry de = srUser.GetDirectoryEntry(); // Where srUser = "anup"
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |