Access attachments in public folder programatically?
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
Access attachments in public folder programatically?

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
Guest






Posted: Wed Oct 12, 2005 3:34 pm    Post subject: Access attachments in public folder programatically? Reply with quote

Problem description:
I want to retrieve the attachemnt of the most recent email sent to an
Exchange public folder. (The public folder is already mail enabled, and
the messages are coming in as they should.)

So far I've managed to access the public folder with this C# code using
WMI:


using System.Management;

// Namespace, class and so on not repeated here.

string serverName = "***";
string publicFolderPath = "/***/";

ConnectionOptions options = new ConnectionOptions();
options.Impersonation = ImpersonationLevel.Impersonate;
options.EnablePrivileges = true;
options.Username = @"***\***";
options.Password = "***";

ManagementScope scope = new ManagementScope(@"\\" + serverName +
@"\root\MicrosoftExchangeV2", options);

ObjectQuery query = new ObjectQuery("SELECT * FROM
Exchange_PublicFolder WHERE Path='" + publicFolderPath + "'");

ManagementObjectSearcher search = new ManagementObjectSearcher(scope,
query);
ManagementObjectCollection publicFolders = search.Get();

// There is just one public folder matching, so a foreach loop here is
overkill.
foreach (ManagementObject publicFolder in publicFolders)
{
// Don't know how to access the messages in the folder.
// Print out some properties about the folder instead.
outputTextBox.AddLine(publicFolder["Path"]);
outputTextBox.AddLine(publicFolder["IsMailEnabled"]);
outputTextBox.AddLine(publicFolder["MessageCount"]);
outputTextBox.AddLine(publicFolder["Url"]);
outputTextBox.AddLine(publicFolder["ParentFriendlyUrl"]);
}

Back to top
Jan Aagaard
Guest





Posted: Wed Oct 12, 2005 3:38 pm    Post subject: Re: Access attachments in public folder programatically? Reply with quote

I forgot to mention that neither the language used (.NET, scripting)
nor the technique (WMI, MAPI, WebDAV, CDOEXM) is important.
Back to top
Michael
Guest





Posted: Wed Oct 12, 2005 3:58 pm    Post subject: Re: Access attachments in public folder programatically? Reply with quote

I'm not sure what is your question here but you can use WebDAV to access to public folder and to retrieve/download email's attachments.
I suggest you first to do SEARCH in order to find new emails. After that you have to use method X-MS-ENUMATTS to get info about attachments

Michael
-------------------------------
If you need WebDAV API for Exchange server,
use our component WebDAV .NET for Exchange.
Check out http://www.independentsoft.com

"Jan Aagaard" <janaagaard@gmail.com> wrote in message news:1129113521.031587.313900@g47g2000cwa.googlegroups.com...
[quote]I forgot to mention that neither the language used (.NET, scripting)
nor the technique (WMI, MAPI, WebDAV, CDOEXM) is important.
[/quote]

Back to top
Jan Aagaard
Guest





Posted: Wed Oct 12, 2005 4:58 pm    Post subject: Re: Access attachments in public folder programatically? Reply with quote

Thanks Michael,

So far I've managed to get a list of the emails in a xml format using
WebDAV (and WMI to get the URI of the public folder).

Now I'm stuck with a href that looks something like this one:
http://servername/ExAdmin/Admin/.../Public%20Folders/.../subject.EML

I've tried opening the mail though CDO.Message.Datasource.Open, but all
I get is a 'Not Implemented' exception.

Any suggestions on how I open this mail, and retrieve the attachment?
Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
Contact Us
New Topics Powered by phpBB