1

I am using the following code to pull email details out of Outlook and into Access.

SELECT *
FROM Inbox IN 'C:\Temp'[Exchange 4.0;MAPILEVEL=me@mycompany.com|];

However, we have a team email box that I want to pull instead but the name of the box includes brackets

Team Support [Company]

So this code is failing, and I cannot figure out how to have it recognize the brackets as part of the name.

FROM Inbox IN 'C:\Temp'[Exchange 4.0;MAPILEVEL=Team Support [Company]|];

I am sure this is a simple solution but can't find guidance online easily.

Thanks,

Adam

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
user2232552
  • 133
  • 1
  • 1
  • 8
  • 1
    Whoa, I didn't know one could do this. -- You can try to switch the query do Design view, open the property sheet, and set the `SourceConnectStr` property there (with brackets). -- I vaguely remember a similar question with a connect string having special chars, that could only be set there. But I don't think I will find it. :( – Andre Jul 19 '17 at 12:55
  • Or you may have to find out the internal name / identifier of the mailbox (which should be an actual email address), that belongs to "Team Support [Company]". Check out the answers here: https://stackoverflow.com/questions/5622477/vba-outlook-seeing-peoples-calendars - while this is about calendar folders it should point you in the right direction. (Or ask your Exchange admins, they should know it). – Andre Jul 19 '17 at 14:29

1 Answers1

0

Looks like you need to escape that bracket in your query.

Something like:

 replace(string, "[", "[[]");

The Quotename function would do this in T-SQL. I.E.

FROM Inbox IN 'C:\Temp'[Exchange 4.0;MAPILEVEL=Team Support quotename('Company')|];
OwlsSleeping
  • 1,487
  • 2
  • 11
  • 19