Skip to main content

Posts

Showing posts from July, 2004

Disabling and Enabling POP3 and IMAP protocol settings via ADSI

  When you install Exchange and create all your mailboxes by default every mailbox will have POP3,IMAP and HTTP protocols enabled. Good practice is if you don't want people to use these protocols is just disable the protocols on the server which makes the user account settings redundant. But this is not always possible and sometimes you need to leave POP3 and IMAP access enabled for some applications or clients. So to stop people using POP3 and IMAP it can be a good idea to disable that protocol on their Active Directory user account.   To do this via ADSI is not that hard if you keep the following things in mind. The property that controls both these setting is the protocolSettings attribute of the User object. This is a mutli-valued property which also holds the setting for HTTP (OWA Access) as well.  By default this property will be blank meaning everything is enabled. Once you disable a protocol a value will get written for that protocol into the property. If you then re-en

Add creator to shared calender entry event sink

  One of the big pains i find when your using a shared calendar in a public folder is that you can't easily tell which user has created each of the calendar entries. I came up with the following sink for a small project I'm working on that will append the name of the creator to the location field of an appointment or meeting request when its created (this will mean it will appear in brackets when you look at the normal calendar view next to each appointment). You can grab the creator of a item from the "http://schemas.microsoft.com/mapi/proptag/0x3FF8001E" mapi property.  Sub ExStoreEvents_OnSave(pEventInfo, bstrURLItem, lFlags) on error resume next Const EVT_NEW_ITEM = 1 Const EVT_IS_DELIVERED = 8 If (lFlags And EVT_IS_DELIVERED) Or (lFlags And EVT_NEW_ITEM) Then  set apptobj = CreateObject("CDO.Appointment") apptobj.datasource.open bstrURLItem,,3 creator = " Created by " & apptobj.fields("http://schemas.microsoft.co

BCC's with CDOEX

This one pops up now and again and can be a little bit of a pain to deal with in CDOEX. In the good old days of CDO 1.2 you could access the recipients collection of an email directly but with CDOEX you can't really do this, you only have a few properties which you can access. On a message the BCC field is an envelope field that you usually don't really care too much about, but when it comes to tasks and meeting requests the BCC field takes on a new perspective. In a task the BCC fields gets used for the StatusOnCompletionRecipients which controls who gets a task completion messages when a task is marked as complete and in a Meeting the BCC field is the resources field. With meeting requests and appointments you can access the recipients collection via the IAttendees interface. So to add a BCC some code like this will work Set appt = CreateObject("CDO.Appointment") Set Atnd = Appt.Attendees.Add Atnd.Address = "resource@yourdomain.com" Atnd.Role

Processing attachments in a embedded email message

I had a question from someone today about how to process the attachments on a embedded email (basically when you get an email that has another email attached to it which has attachments). The basic code to process a set of attachments on a message in Ex2k look like this set msg = createobject("cdo.message") msg.datasource.open "file://./backofficestorage/domain.com/MBX/user/Inbox/Mess.EML" set objattachments = msg.attachments for each objattachment in objattachments      objattachment.savetofile "d:\temp\" & objattachment.filename next If you have an email with a embedded email as an attachment this embedded email will appear in the attachment well of the the other email as content type message/rfc822 but the filename will be blank and the above code would fail to execute at this step. To process these type of messages you need to open the embedded message from the bodypart and then process the attachments on this message. The other

Flip OOF status with OMA Script

The following script continues on from the other days post on scripting with OMA, I've been playing around with this a bit more and although its a bit funny in the way it responds I've come up with the following script which will logon to OMA navigate though all the menus to the OOF section and then change the OOF status. (kind of a lot like batch answer file scripting). I thought I would be cool to come up with a single button oof flipper application for a smart phone.  ObjxmlHttp = CreateObject("Microsoft.XMLHTTP") ObjxmlHttp.Open "get", "http://server/oma/(cvlbrraeffpq1xu5c013j055)/oma.aspx?", False, "domain\user", "password" ObjxmlHttp.setRequestHeader "Accept-Language:", "en-us" ObjxmlHttp.setRequestHeader "Content-type:", "application/x-www-UTF8-encoded" ObjxmlHttp.setRequestHeader "Content-Length:", Len(xmlstr) ObjxmlHttp.Send() Wscript.echo ObjxmlHttp.re

Scripting with OMA - Outlook Mobile Access

Continuing on from some of my other posts about using the Microsoft.XMLHTTP object to do some automation scripting with OWA I've started at looking at doing this in OMA as well. OMA is a lot less feature rich environment because it's designed for mobile devices but from a automation perspective this can be an advantage. There's very little information out there that covers how OMA work's from an indepth technical perspective (well that I could find anyway). But the basics of it is that its a ASP .NET application and from the reverse engineering I've looked at it passes some tokens and GUID looking parameters to make it work. As a starter script I created a simple script that uses the Microsoft.XMLHTTP object to list the contents of the inbox using OMA. Unlike OWA where you can just post a single command to the IIS server with OMA I found it required two requests. The first request logs onto OMA and gets the front page and more importantly a little token (the ufps th

Sending a Mail via OWA from Script

Continuing on from some of my other posts I've done recently regarding reusing OWA commands such as this one I've come up with a script that uses the commands that OWA does to send a new email. Some of the advantages of this is that mail sent via this method ends up in the sent items of the sending mailbox. Its also acts as an alternative where you don't want to use CDO, ADO/Exoledb or WebDAV. stmsgbody ="Hello Fred <BR<BR>" stmsgbody = stmsgbody & "What to get some coffee Mate, Meet me downstairs in ten<BR><BR>" stmsgbody = stmsgbody & "Cheers<BR>" stmsgbody = stmsgbody & "Barney<BR>" szXml = "" szXml = szXml & "Cmd=send" & vbLf szXml = szXml & "MsgTo=youruser@yourdomain.com" & vbLf szXml = szXml & "MsgCc=" & vbLf szXml = szXml & "MsgBcc=" & vbLf szXml = szXml & "urn:schemas:httpmail:

Tracking Email Delivery Time with WMI

One of the subjective problems in any email system is how long a message will take to reach its destination. Mail delivery times are never absolute and will always vary depending on a large number of variables out in the Big Wash (the Internet). Back in Exchange 5.5 one of the companies I used to work for used a software application that sent a mail via a poller and collector account and this is how they measured mail delivery times. In Exchange 2000 if you have message tracking logging enabled this information is actually keep on every message that is tracked in the Deliverytime property of the Exchange_MessageTrackingEntry WMI class. So if you have multiple servers at each point along the way you can look at the delivery time via WMI and you could actually work out how long this message is taking to be delivered over each hop. So what i did today was write a script that looked at the two servers I've got in my production network and worked out firstly what was the deliver

Importing Message Tracking Logs into a Database without using WMI

A while ago I wrote a little Message Tracking Log application that I posted here on OutlookExchange. Somebody asked me today for a way to import a lot of tracking logs that they have archived in a directory where using WMI wasn't really going to be applicable. Fortunately this isn't that hard a thing to do, the message tracking logs are in essence a tab delimited text file with a few twists. The first twist is you really want to ignore the first 5 lines and the second is there is a double Line Feed at the end of each line. But because this is consistent it isn't hard to script around this. So to do the hardwork of sorting out the tab delimited data in VBS you can use the Split command which will split the contents of each line into separate array elements where the delimiter separates the column. You still need to apply the same functions such as converting GMT time to local time and the time and data retrievals are a little different as they are stored in a little
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.