Skip to main content

Posts

Uploading an EML file to a Mailbox with Exchange Web Services

This is a handy little sample to have in your bag of tricks when you need to exchange messages between disparate messaging systems. This code sample is relatively straight forward in that it uses a file stream to read the byte stream of the EML file which is already in MIME format and then uses a createitem operation and posts the MIME content from the data stream to the Exchange Message Store. The only trick that comes in is when you create the Item in whatever folder you want you need to set the message flags property PR_Message_Flags so the message will appear as a normal Sent Mail in Outlook (otherwise it will just appear as a draft). Also you need to set the flag value so it will also appear as Read (unless you want to have it as unread.) The sample itself uploads an eml file from the c: drive to a users sent items folder I’ve put a download copy of the code here the code itself looks like [warning this code sample may cause global warming if you don't configure your pc t...

Exchange Permission and Reverse Permission Powershell Gui version 1 Exchange 2000/3/7

*** There is an update version that include mailbox acls here http://gsexdev.blogspot.com/2008/10/exchange-reverse-permission-audit.html Exchange mailbox permissions getting you down, don’t know who has access to who’s mailbox, rouge admins or legacy permissions or configurations keeping you up at night, can’t get any more the 500 horses out of the V8 under the bonnet. Okay seriously this is kind of rollup script of a lot of vbs scripts that I’ve posted over the past couple of years in regards to Exchange Mailbox, Send and Receive As, Store and delegated Admin rights. It enumerates permissions from Active Directory firstly from all Mailbox rights, Send and Receive As Rights for Exchange Users and then all Mailbox Store ACL’s and finally from the Root Exchange container in the configuration partition to work out the Rights that have been delegated for Exchange System Manager Delegation wizard. It adds all the permissions to ADO.NET datatables and does some calculations to work out fir...

Showing Mailbox Rights and Send-as/Receive As rights in Powershell Exchange 2000/3/7

I’ve been working on some permissions scripts in the past couple of weeks and thought I’d post a powershell port of some VBS code from this http://msdn2.microsoft.com/en-us/library/ms992469(EXCHG.65).aspx msdn article. I’ve use this code before in a variety of scripts to read permissions from the Exchange Mailbox DACL via the msexchmailboxsecuritydescriptor AD property. Of course one should never try to set mailbox rights using this property as per http://support.microsoft.com/kb/310866/ so make sure you always treat it as read only. So what I’ve done is put together a quick sample that uses the new ActiveDirectorySecurity class in .NET 2.0 to basically load the DACL from the bytearray representation of the DACL that’s stored in this property. Also I’ve included some code to retrieve the Send-AS and Receive-AS rights from the AD object's DACL. The code only looks at the Implicitly set ACE's and not the Inherited ACE’s (this could be easily changed) it queries ever mail...

Default Calendar permission Powershell Gui for Exchange 2007

****Note if your using Exchange 2010 SP1 see http://gsexdev.blogspot.com/2011/01/default-calendar-permission-powershell.html which is a version that use the new Exchange Management Shell cmdlets ***** This is a sample script that uses the calendar permission helper class I posted here. This script basically presents a Winform that can be used to firstly enumerate all the default calendar permissions of all mailboxes on an Exchange Server and then you can do a multiple select and set a new default calendar permission level for one or more mailboxes. The script gives the option of specifying the authentication setting to use and the Cas Server you want to use. By default it tries to locate a cas server using the get- WebServicesVirtualDirectory cmdlet eg [array]$calurls = Get-WebServicesVirtualDirectory $strRootURI = $calurls[0].InternalUrl.AbsoluteUri $strRootURI Using EWS impersonation allows you to set the calendar setting on a mailbox that the account running the script doesn...

Class library helper for setting Calendar Permission via Powershell and Exchange 2007

I posted something a while ago that tried to explain how you can go about setting calendar rights using the new features in EWS included in Exchange 2007 SP1. Unfortunately from the feedback i got it seemed to confuse people more than help it seemed most people where interested in resetting the default calendar permissions especially in regards to the new Freebusy Acl’s that where included in Exchange 2007/Outlook 2007. The freebusy rights pose a special challenge because the normal scripts like CDO 1.2 or Pfdavadmin can’t be used to set these particular rights you need to use either the Outlook 2007 OOM or EWS. So I decided to come up with a helper class similar to the OOF helper class I wrote before that would allow people to change the rights on a calendar just using a couple of lines in Powershell. Because I already has a namespace for the OOF helper I decided to fork that code into a new namespace and library and I thought that I’d be able to reuse a lot of what I’d done before...

Exchange 2007 Mail enable User Powershell Quick Form

A couple of weeks okay I had to mail enable (as opposed to create mailboxes) for a bunch of Active Directory accounts in a variety of OU’s in Active Directory. With previous versions of Exchange being able to do this directly from ADUC made this task relative easy and depending on the number of accounts you had to do probably not something that was worth writing a script for. With the loss of this functionality out of ADUC you have to use either a wizard in the Exchange Management Console or do it directly from Powershell. I’m not a fan of the EMC wizards they are there to do a job which they do adequately but are just too time consuming to use for repetitive tasks that aren’t worth writing a larger script to do. So I decided to port the form I had for doing quick mailbox creates to do quick mail enabled's. I wouldn’t say the result was brilliant but in the end once I had the form up I could bang though the accounts I wanted to mail enable resonably quickly (what helped is the...

ActiveSync IIS Log Tool / Powershell GUI Version 1

Anyone trying to administer and manage Windows Mobile Devices when active-syncing against an Exchange 2007 server will know the unique set of challenges keeping an eye on these devices presents. Because all the communication a mobile device makes is via https (well lets hope it is) all this activity is recorded in the IIS Log files. On the Exchange Team blog there are some great scripts that have been published for doing reporting on Exchange Active Sync via the logparser which works really well and is a really fast and functional method if you have large log files. http://msexchangeteam.com/archive/2006/02/14/419562.aspx . Because some of the servers I work on tend to be smaller and greater in number I wanted a better method to do some quick reporting on ActiveSync that was quick, easy to setup and practical to do on a day to day basis. So I thought I put together a little powershell GUI to be able to pull information from an IIS log file about Active-Sync devices and then summari...
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.