E-Mail Address Policy with Custom Filter
Hi,
I'm trying to create a Email Address Policy via PowerShell to set an organizational email address for mail contacts created by SharePoint. They have a targetaddress like 'list@moss1.domain.local' and should get the address 'list@domain.de'.
Unfortunately the normal policy is a bit different, so I have to filter the contact objects by the targetAddress. So I decided to create this Policy with the following filter (variable $policy contains my email address policy):
$policy | Set-EmailAddressPolicy -RecipientFilter {(RecipientType -eq 'MailContact' -and ExternalEmailAddress -like '*.domain.local')}
But this didn't return any results. So I started researching and found some interesting behaviour:
The Like-Operator works according to Technet with several Properties. With Alias it's no problem, but filtering ExternalEmailAddress doesn't work with wildcard characters. Filters like "ExternalEmailAddress -like 'smtp:list@moss1.domain.local' returns
correct results, but if you add the wildcard character it doesn't return any results any more.
If you try the same filter with Get-MailContact filtering with wildcard of the ExternalEmailAddress Property works.
It seems to be a bug, can anyone approve this?
Thanks in advance,
Uwe// Tried and true method for weather forecasting - random numbers. String weather = (new Random()).Next(2)==0?"rainy":"sunny";
April 30th, 2010 1:15pm
If you want something confrimed as a bug I believe you're going to have to open a ticket with Microsoft Support. If it indeed is a bug, I believe you won't have to pay for the incident. However, since you admit to having found
documentation saying that it doesn't work, then I think it's safe to say that it isn't a bug and Microsoft will rule that it's "by design".
I suggest you choose a different property to use for your filter.
--
Ed Crowley MVP
"There are seldom good technological solutions to behavioral problems."
.
"Uwe82" wrote in message
news:ed288c4f-7b5d-44be-bd3e-a40cc6a1dfb9...
Hi,
I'm trying to create a Email Address Policy via PowerShell to set an organizational email address for mail contacts created by SharePoint. They have a targetaddress like 'list@moss1.domain.local' and should get the address 'list@domain.de'.
Unfortunately the normal policy is a bit different, so I have to filter the contact objects by the targetAddress. So I decided to create this Policy with the following filter (variable $policy contains my email address policy):
$policy | Set-EmailAddressPolicy -RecipientFilter {(RecipientType -eq 'MailContact' -and ExternalEmailAddress -like '*.domain.local')}
But this didn't return any results. So I started researching and found some interesting behaviour:
The Like-Operator works according to Technet with several Properties. With Alias it's no problem, but filtering ExternalEmailAddress doesn't work with wildcard characters. Filters like "ExternalEmailAddress -like 'smtp:list@moss1.domain.local' returns correct
results, but if you add the wildcard character it doesn't return any results any more.
If you try the same filter with Get-MailContact filtering with wildcard of the ExternalEmailAddress Property works.
It seems to be a bug, can anyone approve this?
Thanks in advance,
Uwe
// Tried and true method for weather forecasting - random numbers. String weather = (new Random()).Next(2)==0?"rainy":"sunny";Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
April 30th, 2010 8:33pm
Hmmm, ok. Thats not really the answer, I expected, but ok. I know, that I have to open a case to have a bug confirmed. I just want to make sure that I didn't miss anything.
I did some more testing on this. Fact is, that Microsoft states
in this article , that ExternalEmailAddress is filterable with Wildcard Character, just like WindowsEmailAddress. (My explanations above were not exactly 100% understandable the way I meant, sorry about this.)
But for both properties it doesn't work in Exchange 2007, in Exchange 2010 it does.
So, it doesn't make sense to use another Property, because no other property contains the data, that I need for this!
// Tried and true method for weather forecasting - random numbers. String weather = (new Random()).Next(2)==0?"rainy":"sunny";
May 3rd, 2010 2:39pm
Hmmm, ok. Thats not really the answer, I expected, but ok. I know, that I have to open a case to have a bug confirmed. I just want to make sure that I didn't miss anything.
I did some more testing on this. Fact is, that Microsoft states
in this article , that ExternalEmailAddress is filterable with Wildcard Character, just like WindowsEmailAddress. (My explanations above were not exactly 100% understandable the way I meant, sorry about this.)
But for both properties it doesn't work in Exchange 2007, in Exchange 2010 it does.
So, it doesn't make sense to use another Property, because no other property contains the data, that I need for this!
// Tried and true method for weather forecasting - random numbers. String weather = (new Random()).Next(2)==0?"rainy":"sunny";
I guess by other property Ed meant to say that put some identifier value in some attribute , say, CustomAttribute1 contains "SharepointContact" and then edit your policy like this
$policy | Set-EmailAddressPolicy -RecipientFilter {(RecipientType -eq 'MailContact' -and CustomAttribute1 -q 'SharepointContact')}
Here you will have to put "SharepointContact"
in the Custom Attribute1 of all the Sharepoint contacts which you want the EAP applied on, like this
get-mailcontact -filter {ExternalEmailAddress
-like '*.domain.local'}|set-mailContact -CustomAttribute1 "SharepointContact"
I understand it's somewhat undesirable for you bcoz you will have to set the custom attribute every time you create a contact
for Sharepoint but is a solution if you are not able to do it the way you want with External Email Address.
Regards,Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM)
www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
May 3rd, 2010 3:02pm
Hi,
What's version of your Exchange server? I have tested on my lab, that is working when using the wildcard for the ExternalEmailAddress parameter under Set-EmailAddressPolicy command. The result is displayed as I expected.
Could you post the full command that you tested on your scenario?
Thanks
Allen
May 4th, 2010 9:51am
It's Exchange 2007 SP2. Yesterday I set up a Virtual Environment with Ex2007 RTM and it worked there too. I think, there's something wrong with my EAP. I created it using the console and then edited it with PowerShell-Cmdlet stated in my first post. Unfortunately,
I have to wait until I am at the customer's site again.
Thanks for checking, Allen!
@Laeeq: This would be a solution that doesn't save any work, because then I can also manually add the email address for newly created contacts ;)// Tried and true method for weather forecasting - random numbers. String weather = (new Random()).Next(2)==0?"rainy":"sunny";
Free Windows Admin Tool Kit Click here and download it now
May 4th, 2010 10:39am
Hi,
Fine, hope to get your next update.
Thanks
Allen
May 6th, 2010 12:34pm