Red Paranoid
Red Paranoid

Reputation: 1

Retrieving calendar information from a mailbox with a special character in its primary e-mail address

I've been writing code to retrieve calendar info from a room mailbox using Exchange Web Services. I'm able to successfully retrieve info from room mailboxes and user mailboxes alike, but I seem to have hit a snag. My theory is that it has to do with the ampersand in the address... I can confirm that this is the primary address of the room mailbox. I've also made sure that I can access the calendar from outlook.

Here's my code which, once again, works really well on other mailboxes but fails with this one:

            EmailAddressType mailbox = new EmailAddressType();
            mailbox.EmailAddress = "r&[email protected]";
            DistinguishedFolderIdType[] parentFolderId = new DistinguishedFolderIdType[1];
            parentFolderId[0] = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.calendar, Mailbox = mailbox };

Has anyone experienced problems of this kind before? Any chance you might be able to nudge me in the right direction? Any help appreciated!

TIA, Rick.

Upvotes: 0

Views: 312

Answers (1)

Garrison Neely
Garrison Neely

Reputation: 3289

You are probably right. Try replacing it with &

Explanation: Since this is going across a Web Service, it's probably getting parsed into XML at some point, and the & character is reserved. So you need to use & any time you want to use & in a string.

Upvotes: 1

Related Questions