Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Wed, 06 Feb 2008 10:40:10 -0500,    group: microsoft.public.exchange.development        back       


Code example for foreign connector (c#) for Exchange 2007   
Can anyone point me to a skeleton of a foreign connector for Exchange
2007?  I have found documentation for numerous things (the cmdlet) but
nothing that has code examples.  I understand the namespaces for TNEF,
etc. but was looking for a starting point, such as class to derive
from, etc.

Thanks, David
date: Wed, 06 Feb 2008 10:40:10 -0500   author:   David

Re: Code example for foreign connector (c#) for Exchange 2007   
>Can anyone point me to a skeleton of a foreign connector for Exchange
>2007?

As far as I know, MS don't have an example - they certainly didn't
over 18 months ago when the company I work for started their E12
gateway project.

Dave
date: Thu, 07 Feb 2008 18:58:07 +0000   author:   David Lowndes lid

Re: Code example for foreign connector (c#) for Exchange 2007   
I'm started with a windows service that has two FileSystemWatcher on
certain directories.  The first directory is the DropDirectory I set
using the Set-ForeignConnector.  I'm then going to use the
Microsoft.Exchange.Data.Mime and
Microsoft.Exchange.Data.ContentTypes.Tnef to extract the information
from the .eml files and format for my foreign e-mail system.  The
other FileSystemWatcher is the directory my foreign email system will
drop files.  I will format those and then save into the Replay
directory.

Does this sound right?

Thanks, David

On Thu, 07 Feb 2008 18:58:07 +0000, David Lowndes
<DavidL@example.invalid> wrote:

>>Can anyone point me to a skeleton of a foreign connector for Exchange
>>2007?
>
>As far as I know, MS don't have an example - they certainly didn't
>over 18 months ago when the company I work for started their E12
>gateway project.
>
>Dave
date: Mon, 11 Feb 2008 12:23:31 -0500   author:   David

Re: Code example for foreign connector (c#) for Exchange 2007   
>I'm started with a windows service that has two FileSystemWatcher on
>certain directories.  The first directory is the DropDirectory I set
>using the Set-ForeignConnector.  I'm then going to use the
>Microsoft.Exchange.Data.Mime and
>Microsoft.Exchange.Data.ContentTypes.Tnef to extract the information
>from the .eml files and format for my foreign e-mail system.  The
>other FileSystemWatcher is the directory my foreign email system will
>drop files.  I will format those and then save into the Replay
>directory.
>
>Does this sound right?

Yes, that sounds like it mirrors what we have. You'll probably find
you need to use quite a few of the Microsoft.Exchange.Data.* modules.

Dave
date: Tue, 12 Feb 2008 09:56:28 +0000   author:   David Lowndes lid

Re: Code example for foreign connector (c#) for Exchange 2007   
I ran into an issue.  I used to be able with the MAPI gateway use the
"post to" seperately from the display to, display cc and display bcc.
That way if someone in the foreign email mails to foreign users and
Exchange users, the header looked right (for reply) all in Exchange.
If I use the Microsoft.Exchange.Data.Transport.Email object and then
the MimeDocument to write an eml file I can't figure out if I can do
it.

On Tue, 12 Feb 2008 09:56:28 +0000, David Lowndes
<DavidL@example.invalid> wrote:

>>I'm started with a windows service that has two FileSystemWatcher on
>>certain directories.  The first directory is the DropDirectory I set
>>using the Set-ForeignConnector.  I'm then going to use the
>>Microsoft.Exchange.Data.Mime and
>>Microsoft.Exchange.Data.ContentTypes.Tnef to extract the information
>>from the .eml files and format for my foreign e-mail system.  The
>>other FileSystemWatcher is the directory my foreign email system will
>>drop files.  I will format those and then save into the Replay
>>directory.
>>
>>Does this sound right?
>
>Yes, that sounds like it mirrors what we have. You'll probably find
>you need to use quite a few of the Microsoft.Exchange.Data.* modules.
>
>Dave
date: Fri, 29 Feb 2008 14:28:22 -0500   author:   David

Re: Code example for foreign connector (c#) for Exchange 2007   
>I ran into an issue.  I used to be able with the MAPI gateway use the
>"post to" seperately from the display to, display cc and display bcc.
>That way if someone in the foreign email mails to foreign users and
>Exchange users, the header looked right (for reply) all in Exchange.
>If I use the Microsoft.Exchange.Data.Transport.Email object and then
>the MimeDocument to write an eml file I can't figure out if I can do
>it.

I'm not familiar enough with how you've described things to give you a
definitive answer.

When you say "post to", do you mean "reply to"?
Can you explain what you do in your MAPI gateway version and what the
effect is when an Exchange user uses Reply All?

Dave
date: Mon, 03 Mar 2008 10:23:55 +0000   author:   David Lowndes lid

Re: Code example for foreign connector (c#) for Exchange 2007   
for example, lets say my foreign users are of EDK address types with
domain of foreign.acme.  The Exchange users have a secondary EDK
address of exchange.acme.  If I am a foreign user and I email a letter
to 2 foreign users and 1 exchange user, I want the header for the
exchange user to show the 2 foreign users as well.  I would use the
"post to" for the Exchange user, and I would set the "display to" to
be all three users.  Using the "post to" stopped the original email
from coming back to the foreign users when I post it thru the gateway.
So after the email is delivered, if the Exchange user hits reply all,
it goes back to the 3 foreign users.   

If I set the TO in the Microsoft.Exchange.Data.Transport.Email to show
both the foreign and Exchange users, will I get a email back coming
thru the connector?  Do I use the "ReplyTo" attribute similar to the
old "post to" of MAPI

Did you keep the EDK address space for your new gateway (for
replyability of the old emails)?

On Mon, 03 Mar 2008 10:23:55 +0000, David Lowndes
<DavidL@example.invalid> wrote:

>>I ran into an issue.  I used to be able with the MAPI gateway use the
>>"post to" seperately from the display to, display cc and display bcc.
>>That way if someone in the foreign email mails to foreign users and
>>Exchange users, the header looked right (for reply) all in Exchange.
>>If I use the Microsoft.Exchange.Data.Transport.Email object and then
>>the MimeDocument to write an eml file I can't figure out if I can do
>>it.
>
>I'm not familiar enough with how you've described things to give you a
>definitive answer.
>
>When you say "post to", do you mean "reply to"?
>Can you explain what you do in your MAPI gateway version and what the
>effect is when an Exchange user uses Reply All?
>
>Dave
date: Mon, 03 Mar 2008 10:32:05 -0500   author:   David

Re: Code example for foreign connector (c#) for Exchange 2007   
>for example, lets say my foreign users are of EDK address types with
>domain of foreign.acme.

I'm not sure what you mean by an "EDK address type" - do you mean
whether the address space of the gateway is "SMTP", "X400", or some
other name - or something different?

>  The Exchange users have a secondary EDK
>address of exchange.acme.

Is that so you can lookup users on the Exchange system as though they
were addressed using the foreign address formats?

> If I am a foreign user and I email a letter
>to 2 foreign users and 1 exchange user, I want the header for the
>exchange user to show the 2 foreign users as well.

OK, in an EX2003 gateway, doesn't that equate to putting all the
recipient addresses on the content message and only the Exchange
recipients on the message envelope?

> whereas the  I would use the
>"post to" for the Exchange user, and I would set the "display to" to
>be all three users.

Again, I'm not familiar with the terminology you're using - I don't
recall hearing of a "post to" - but I'm no expert in this field, so I
might not just know. What does "post to" equate to in MAPI terms?

>Using the "post to" stopped the original email
>from coming back to the foreign users when I post it thru the gateway.

OK, so without this "post to" that you refer to, your gateway passed a
message addressed to all 3 recipients on to Exchange. Exchange
couldn't find mailboxes for those recipients so it would try to route
those back out of your gateway - and presumably you'd then have
problems with the messages re-circulating?

>So after the email is delivered, if the Exchange user hits reply all,
>it goes back to the 3 foreign users.

In the world I'm more familiar with, as I mentioned before, all
recipient addresses would be on the content part of the message (which
is a message type attachment of the outer MAPI message) while the
outer envelope would have had only the Exchange recipient. The routing
is done on the envelope recipients, so the circulating issue wouldn't
occur.

>If I set the TO in the Microsoft.Exchange.Data.Transport.Email to show
>both the foreign and Exchange users, will I get a email back coming
>thru the connector?

I'm not sure - try it and see what happens. Normally the To: header
contains all the recipients (equivalent to the content message in a
MAPI gateway).

I suspect your issue may be that in your gateway you don't have any
differentiation between the envelope and content recipients - and (in
a brief reading) it appears that SMTP headers (which would contain the
envelope recipients) are often stripped from the normal headers
received from a POP3 mailbox - though sometimes there may be a residue
in an X header, such as "X-Envelope-To", or "X-Original-To", or it may
be parsed from the "Received" (for section) header.

> Do I use the "ReplyTo" attribute similar to the
> old "post to" of MAPI

As I don't know what "post to" is, I can't say.

>Did you keep the EDK address space for your new gateway (for
>replyability of the old emails)?

I'm not sure what you mean there. In our gateways the user (admin) can
configure the address space.

Dave
date: Mon, 03 Mar 2008 19:35:02 +0000   author:   David Lowndes lid

Re: Code example for foreign connector (c#) for Exchange 2007   
Ok...read up some more on the replay directory and looks like I have
to use the "X-Receiver".  For anone who reads this and is interested I
copied some doc from Microsoft Exchange TechCenter below.  One last
question to you David...how did you add the X-Headers to the email
object as the Microsoft.Exchange.Data.Transport.Email does not support
it.  

X-Receiver:   This X-Header replaces the To: message header field
requirement in a typical SMTP message. At least one X-Receiver: field
that contains one e-mail address must exist. Multiple X-Receiver:
fields are allowed for multiple recipients. The Replay directory
ignores the To: message header fields if they are present, although
the recipient's e-mail client displays the values of the To: message
header fields as the recipients of the message.

On Mon, 03 Mar 2008 19:35:02 +0000, David Lowndes
<DavidL@example.invalid> wrote:

>>for example, lets say my foreign users are of EDK address types with
>>domain of foreign.acme.
>
>I'm not sure what you mean by an "EDK address type" - do you mean
>whether the address space of the gateway is "SMTP", "X400", or some
>other name - or something different?
>
>>  The Exchange users have a secondary EDK
>>address of exchange.acme.
>
>Is that so you can lookup users on the Exchange system as though they
>were addressed using the foreign address formats?
>
>> If I am a foreign user and I email a letter
>>to 2 foreign users and 1 exchange user, I want the header for the
>>exchange user to show the 2 foreign users as well.
>
>OK, in an EX2003 gateway, doesn't that equate to putting all the
>recipient addresses on the content message and only the Exchange
>recipients on the message envelope?
>
>> whereas the  I would use the
>>"post to" for the Exchange user, and I would set the "display to" to
>>be all three users.
>
>Again, I'm not familiar with the terminology you're using - I don't
>recall hearing of a "post to" - but I'm no expert in this field, so I
>might not just know. What does "post to" equate to in MAPI terms?
>
>>Using the "post to" stopped the original email
>>from coming back to the foreign users when I post it thru the gateway.
>
>OK, so without this "post to" that you refer to, your gateway passed a
>message addressed to all 3 recipients on to Exchange. Exchange
>couldn't find mailboxes for those recipients so it would try to route
>those back out of your gateway - and presumably you'd then have
>problems with the messages re-circulating?
>
>>So after the email is delivered, if the Exchange user hits reply all,
>>it goes back to the 3 foreign users.
>
>In the world I'm more familiar with, as I mentioned before, all
>recipient addresses would be on the content part of the message (which
>is a message type attachment of the outer MAPI message) while the
>outer envelope would have had only the Exchange recipient. The routing
>is done on the envelope recipients, so the circulating issue wouldn't
>occur.
>
>>If I set the TO in the Microsoft.Exchange.Data.Transport.Email to show
>>both the foreign and Exchange users, will I get a email back coming
>>thru the connector?
>
>I'm not sure - try it and see what happens. Normally the To: header
>contains all the recipients (equivalent to the content message in a
>MAPI gateway).
>
>I suspect your issue may be that in your gateway you don't have any
>differentiation between the envelope and content recipients - and (in
>a brief reading) it appears that SMTP headers (which would contain the
>envelope recipients) are often stripped from the normal headers
>received from a POP3 mailbox - though sometimes there may be a residue
>in an X header, such as "X-Envelope-To", or "X-Original-To", or it may
>be parsed from the "Received" (for section) header.
>
>> Do I use the "ReplyTo" attribute similar to the
>> old "post to" of MAPI
>
>As I don't know what "post to" is, I can't say.
>
>>Did you keep the EDK address space for your new gateway (for
>>replyability of the old emails)?
>
>I'm not sure what you mean there. In our gateways the user (admin) can
>configure the address space.
>
>Dave
date: Mon, 03 Mar 2008 20:56:58 -0500   author:   David

Re: Code example for foreign connector (c#) for Exchange 2007   
MimeDocument mdMimeDoc = email.MimeDocument;
HeaderList hlHeaderlist = mdMimeDoc.RootPart.Headers;
Header mhProcHeader = hlHeaderlist.FindFirst("X-Receiver");
if (mhProcHeader == null)
{
   MimeNode fhFirstHeader = hlHeaderlist.FirstChild;
   TextHeader nhNewHeader = new TextHeader("X-Receiver",
"<user@domain>");
   hlHeaderlist.InsertBefore(nhNewHeader, fhFirstHeader);
}


On Mon, 03 Mar 2008 20:56:58 -0500, David
 wrote:

>Ok...read up some more on the replay directory and looks like I have
>to use the "X-Receiver".  For anone who reads this and is interested I
>copied some doc from Microsoft Exchange TechCenter below.  One last
>question to you David...how did you add the X-Headers to the email
>object as the Microsoft.Exchange.Data.Transport.Email does not support
>it.  
>
>X-Receiver:   This X-Header replaces the To: message header field
>requirement in a typical SMTP message. At least one X-Receiver: field
>that contains one e-mail address must exist. Multiple X-Receiver:
>fields are allowed for multiple recipients. The Replay directory
>ignores the To: message header fields if they are present, although
>the recipient's e-mail client displays the values of the To: message
>header fields as the recipients of the message.
>
>On Mon, 03 Mar 2008 19:35:02 +0000, David Lowndes
><DavidL@example.invalid> wrote:
>
>>>for example, lets say my foreign users are of EDK address types with
>>>domain of foreign.acme.
>>
>>I'm not sure what you mean by an "EDK address type" - do you mean
>>whether the address space of the gateway is "SMTP", "X400", or some
>>other name - or something different?
>>
>>>  The Exchange users have a secondary EDK
>>>address of exchange.acme.
>>
>>Is that so you can lookup users on the Exchange system as though they
>>were addressed using the foreign address formats?
>>
>>> If I am a foreign user and I email a letter
>>>to 2 foreign users and 1 exchange user, I want the header for the
>>>exchange user to show the 2 foreign users as well.
>>
>>OK, in an EX2003 gateway, doesn't that equate to putting all the
>>recipient addresses on the content message and only the Exchange
>>recipients on the message envelope?
>>
>>> whereas the  I would use the
>>>"post to" for the Exchange user, and I would set the "display to" to
>>>be all three users.
>>
>>Again, I'm not familiar with the terminology you're using - I don't
>>recall hearing of a "post to" - but I'm no expert in this field, so I
>>might not just know. What does "post to" equate to in MAPI terms?
>>
>>>Using the "post to" stopped the original email
>>>from coming back to the foreign users when I post it thru the gateway.
>>
>>OK, so without this "post to" that you refer to, your gateway passed a
>>message addressed to all 3 recipients on to Exchange. Exchange
>>couldn't find mailboxes for those recipients so it would try to route
>>those back out of your gateway - and presumably you'd then have
>>problems with the messages re-circulating?
>>
>>>So after the email is delivered, if the Exchange user hits reply all,
>>>it goes back to the 3 foreign users.
>>
>>In the world I'm more familiar with, as I mentioned before, all
>>recipient addresses would be on the content part of the message (which
>>is a message type attachment of the outer MAPI message) while the
>>outer envelope would have had only the Exchange recipient. The routing
>>is done on the envelope recipients, so the circulating issue wouldn't
>>occur.
>>
>>>If I set the TO in the Microsoft.Exchange.Data.Transport.Email to show
>>>both the foreign and Exchange users, will I get a email back coming
>>>thru the connector?
>>
>>I'm not sure - try it and see what happens. Normally the To: header
>>contains all the recipients (equivalent to the content message in a
>>MAPI gateway).
>>
>>I suspect your issue may be that in your gateway you don't have any
>>differentiation between the envelope and content recipients - and (in
>>a brief reading) it appears that SMTP headers (which would contain the
>>envelope recipients) are often stripped from the normal headers
>>received from a POP3 mailbox - though sometimes there may be a residue
>>in an X header, such as "X-Envelope-To", or "X-Original-To", or it may
>>be parsed from the "Received" (for section) header.
>>
>>> Do I use the "ReplyTo" attribute similar to the
>>> old "post to" of MAPI
>>
>>As I don't know what "post to" is, I can't say.
>>
>>>Did you keep the EDK address space for your new gateway (for
>>>replyability of the old emails)?
>>
>>I'm not sure what you mean there. In our gateways the user (admin) can
>>configure the address space.
>>
>>Dave
date: Mon, 03 Mar 2008 22:06:13 -0500   author:   David

Re: Code example for foreign connector (c#) for Exchange 2007   
>Ok...read up some more on the replay directory and looks like I have
>to use the "X-Receiver".  For anone who reads this and is interested I
>copied some doc from Microsoft Exchange TechCenter below.  One last
>question to you David...how did you add the X-Headers to the email
>object as the Microsoft.Exchange.Data.Transport.Email does not support
>it.  

We have code like this:

	streamWriter.WriteLine( "X-Receiver: " + xreceiver );

and then write the stream using:

	newEmailMsg.MimeDocument.WriteTo( streamWriter.BaseStream );

I'm not intimately familiar with those areas of the code though.

>X-Receiver:   This X-Header replaces the To: message header field
>requirement in a typical SMTP message. At least one X-Receiver: field
>that contains one e-mail address must exist. Multiple X-Receiver:
>fields are allowed for multiple recipients. The Replay directory
>ignores the To: message header fields if they are present, although
>the recipient's e-mail client displays the values of the To: message
>header fields as the recipients of the message.

OK, it sounds (and examining our code seems to confirm it) that the
X-Receiver header are the envelope recipients, and the To header are
the content recipients.

Dave
date: Tue, 04 Mar 2008 09:49:03 +0000   author:   David Lowndes lid

Re: Code example for foreign connector (c#) for Exchange 2007   
The X-Receiver works great.  

I do have another problem.  I created a connector for SMTP domain (ex.
connect.domain.com).  I have contacts created with the primary SMTP
address of first.last@connect.domain.com.  They have a secondary SMTP
address of just domain.com.  I have tried dropping eml files into the
replay directory with the X-sender set to either address and email
destined for external (hotmail, gmail, etc.) domains but they never
arrive.  They are delivered to the Exchange (internal) without issues.
The eml is renamed to tmp and deleted so in Exchange's eyes...they
should be delivered...right?

On Tue, 04 Mar 2008 09:49:03 +0000, David Lowndes
<DavidL@example.invalid> wrote:

>>Ok...read up some more on the replay directory and looks like I have
>>to use the "X-Receiver".  For anone who reads this and is interested I
>>copied some doc from Microsoft Exchange TechCenter below.  One last
>>question to you David...how did you add the X-Headers to the email
>>object as the Microsoft.Exchange.Data.Transport.Email does not support
>>it.  
>
>We have code like this:
>
>	streamWriter.WriteLine( "X-Receiver: " + xreceiver );
>
>and then write the stream using:
>
>	newEmailMsg.MimeDocument.WriteTo( streamWriter.BaseStream );
>
>I'm not intimately familiar with those areas of the code though.
>
>>X-Receiver:   This X-Header replaces the To: message header field
>>requirement in a typical SMTP message. At least one X-Receiver: field
>>that contains one e-mail address must exist. Multiple X-Receiver:
>>fields are allowed for multiple recipients. The Replay directory
>>ignores the To: message header fields if they are present, although
>>the recipient's e-mail client displays the values of the To: message
>>header fields as the recipients of the message.
>
>OK, it sounds (and examining our code seems to confirm it) that the
>X-Receiver header are the envelope recipients, and the To header are
>the content recipients.
>
>Dave
date: Tue, 04 Mar 2008 15:51:07 -0500   author:   David

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us