I found the following post(see bottom of post) in the archive of this forum.
Does anyone know how you can use this technique to import data?

More precise I need to extract from the exchange server how much mail (in MB) each user gets each day, and save it in an SQL table. Does anyone kow what I need to alter to make this code do the trick?

I understand how to query yhe data, I just don't know how to "save" it in the DB



Thank you


SHivan



************************************************** *********

You can use SQL Server 2000's "Linked Server" and the Exchange OLE provider
to query as well as import data, for example:

-- Modify the following queries to point to your Exchange 2000 PF hierarchy
-- Add a linked server for the Exchange 2000 PF store
-- Note that the datasource named uses the Exchange 2000 domain name, not a
server name
exec sp_addlinkedserver 'E2K_PF', 'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:%5C\.\backofficestorage\visibility.exchg.com \public folders'

-- Query for a list of Contact entries in a PF
select convert(varchar(50), "urn:schemas:contacts:sn") as LastName,
convert(varchar(50), "urn:schemas:contacts:givenName") as FirstName
from openquery(E2K_PF,
'select "urn:schemas:contacts:sn",
"urn:schemas:contacts:givenName"
from scope(''shallow traversal of ".\Exchg\Atlanta\Atlanta Contacts"'')')

-- Examples for querying a specific mailbox in Exchange 2000:
-- Modify the following queries to point to a specific Exchange 2000 mailbox

-- Add a linked server for the Exchange 2000 mailbox
-- Note that the login you use to query with must have access to this
mailbox's folders
exec sp_addlinkedserver 'E2K_Administrator', 'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:%5C\.\backofficestorage\visibility.exchg.com \MBX\Administrator'