Skip to main content

Posts

Showing posts from October, 2007

Uploading a document into a SharePoint Document library from a Exchange 2007 Transport Agent.

SharePoint servers these days are multiplying like rabbits while Sharepoint is a great place to put and index information breaking habits and making sure you have a central repository of things is always a challenge. What this agent does is looks at any email which has any Pdf attachments that have the word “quote” in the filename if these emails have any external recipients this document will get uploaded into a specific SharePoint’s sites shared documents library. So this allows me in this case to have a central repository of all the quotes sent out via email. To make sure the documents that are being uploaded have a unique filename the processing time is added to the filename of the document at the time it’s uploaded to SharePoint. Because programmatically uploading a document into SharePoint isn’t that straight forward To upload the document into the SharePoint Document library itself I’ve use the S.S. Ahmed cool WSUploadservice which is free,easy to install and use you can get

Exchange 2007 Content Agent Log Message Tracker Gui

One of the cool features from a logging perspective on Exchange 2007 is the ability to log the SCL of every message when you have the Content Filtering Agent enabled (and also logging enabled). There is a Exchange Management Shell powershell cmdlet for reading these logs called get-agentlog which gives a good cmdline experience but as these logs are something you might want to check on a regular basis and the information contained in them is a little unwieldy to display in a cmdline environment I decided to put together a little GUI to make my life a little easier. I based the GUI on my Exchange 2000/3 WMI message tracker and I was able to carry over a lot of the cool little aggregation functions of this utility using most of the same code with a few tweaks here and there. What this script does is creates a Winform and adds a whole bunch of controls to that winform such as datapickers, textboxes, checkboxes,labels and buttons. Its then wires ups some functions to the button clicks

Adding an attachment in a Transport Agent on Exchange 2007

This is a quick post to give an example of something that from the outset I would have thought would be easy but for some reason took me a little time to get my head around. Having been using CDOSYS/EX for a number of years adding a attachment to a message Is as easy as just using the addattachment method and specifying the filepath and the class will do the rest and add that attachment to the message. When working in a transport agent with the Microsoft.Exchange.Data.Transport.Email class to add an attachment you can use the attachment collections add method . There is an overload for this method that allows you to specify the filename which I thought would mean that this would work like CDOSYS’s addattachment method which didn’t turn out to be the case. Using this overload just gives you a blank attachment object with the filename property set. So to add an attachment within a Transport agent you first need to open the file in question and read-in the stream of bytes from the file

Adding Document Favorite links for Direct File Access in OWA 2007 via a script

Direct File access is a pretty cool feature of OWA 2007 although may not be the easiest thing for your average user to get their head around. Somebody asked a question about pre-populating the favorites for a user which is a pretty good idea (actually when you think about it you really want something that’s policy driven). Currently there is no really easy or supported way of doing this programmatically. The document links themselves are stored in a storage item with a messageclass of IPM.Configuration.Owa.DocumentLibraryFavorites in the associated folder collection of NON_IPM_Subtree root of a mailbox. On this storage item there is a binary mapi property 0x7C080102 and the links are stored in a XML document. I decided to see if I could write a script that could open this storage item and then add some nodes into the already existing property or create the property if it didn’t exist. The format of the doclib node looks something like <docLib uri="file://sername/direct

Processing embedded attachments in a Transport Agent

Continuing on from my other post last week this is a little bit more of an advanced Transport agent that can process attachments within embedded messages down to any depth. Most of the code is the same as last week except that the structure of the code has been changed so each message and embedded message is processed by the routine. To see if a attachment has an assoiciated embeeded message all you need to do is check the EmbeddedMessage property on each message. The one thing that I found interesting is when processing an embedded message vs. just processing the message that caused the Agent to fire is that there is no underlying MIME document so the code I had that was saving out the message to a separate directory using the MIME document in this case wouldn’t work for an embedded message. As I was really only interested in processing attachments this was not so much of a problem but its one thing to be careful of if you do what to processes embedded messages. For details of what th
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.