Link to home
Start Free TrialLog in
Avatar of NelsonR
NelsonR

asked on

Use Outlook COM objects from shared profile/Install MAPI

System: Windows 2000, Exchange 2000, Outlook XP (2002)

I have made a program that accesses an Outlook public appointments folder by creating an Outlook.Application OLE object.  It allows the user only to add appointments at certain times and 1 hour blocks.  It works just fine under my profile.

My problem now is that there is a group of about 50 users that have a shared mandatory Windows profile and do not have an Outlook profile (using a group policy, Outlook.exe is blocked).  I somehow need to be able to access the public folder anyway.

Possible solution #1:
Create a "dummy" Exchange 2000 account (by creating a new user in Active Directory) that everyone uses.  Set it up for the shared profile.

Problem:
olFolder := olNameSpace.Folders('Public Folders').Folders('All Public Folders').Folders('Appts');
gives a "You do not have permission to log on" error, even though I gave the "dummy" user "Owner" permissions.


Possible solution #2:
Use MAPI.Session instead of Outlook.Application.  This will provide the ProfileInfo parameter in the olNameSpace.Logon method (look at http://support.microsoft.com/default.aspx?scid=kb;EN-US;q195662).

Problem:
During runtime, olApp := CreateOleObject('MAPI.Session'); gives the error "Invalid class string".  I have installed Outlook 2002 and set up an Exchange account, which should have installed MAPI, but apparently it hasn't.  I've searched all over the web and can't find any other way to install it (or make sure it is).

Possible solution #3:
Do you have any? :)

So in summary, I need to somehow install MAPI so "MAPI.Session" will work, or fix "You do not have permission to log on".

Any help is appreciated.  I am out of ideas right now.
Avatar of StevenB
StevenB

 To use The MAPI.Session Object I'm pretty sure you need to have CDO installed. The default install of Outlook does not install CDO if I recall correctly, you have to select it specifically. http://www.cdolive.com/ is a great site for CDO and MAPI info.

  Hope this helps somewhat.

  Steven
Avatar of NelsonR

ASKER

Where do you select it specifically?  I couldn't find it anywhere.  Also, cdolive is outdated :(
 On your Office 2000 CD select "Add or Remove Features". When presented with the options dropdowns make sure that "Microsoft Office -> Microsoft Outlook for Windows -> Collaboration Data Objects" is selected, by default it is not. This should give you access to CDO programming functionality.

  The http://www.cdolive.com/ site is undergoing upgrades, but the old content is avbailable at http://www.cdolive.com/start.htm in particular the CDO help file available at http://www.cdolive.net/download/cdo.zip is a great resource.

  Regards,

  Steven.
 
Avatar of NelsonR

ASKER

I figured out how to install CDO and finally was able to log on, etc.  Now that I ran the program from the shared user's account I got a "You do not have permission to log on. [Microsoft Exchange Server Information Store - [MAPI_E_FAILONEPROVIDER(8004011D)]]." error.. :(

Here's my code:
------------------
 cdoSession := CoSession.Create;
 cdoSession.Logon('', '', false, true, 0, true, 'Mail' + #10 + 'OutlookAccess');
 cdoPublicStore := cdoOpenFolder(cdoSession.InfoStores.Item[1].RootFolder.Folders, 'All Public Folders');
 cdoACNAppt := cdoOpenFolder(cdoOpenFolder(cdoPublicStore.Folders, 'ACN').Folders, 'Appointments').Messages;

 cdoMessage := cdoACNAppt.GetFirst;
 ShowMessage(cdoMessage.Subject);

--------------

function TfACNAppts.cdoOpenFolder(Folders: OleVariant; FolderToOpen: String): OleVariant;
var i: Integer;
begin
 for i := 1 to Folders.Count do
  if Folders.Item[i].Name = FolderToOpen then
  begin
   Result := Folders.Item[i];
   break;
  end;
end;
--------------

Note the Logon() function that has:
'Mail' + #10 + 'OutlookAccess'

I am connecting to the server named 'Mail' to the account 'OutlookAccess', so it shouldn't be using the local profile.  Why does it work for me (domain admin) and not them (domain users only)?
Avatar of NelsonR

ASKER

I might have solved it. I just gave "Everyone" full rights to the "OutlookAccess" mailbox.. It now logs in.. I am getting another error later on which I wasn't getting before, but I should be fine.
Avatar of NelsonR

ASKER

Hmm.. OK, so it logs in, but now it can't find the "ACN" folder (Appointments is a subfolder) even though 'OutlookAccess' has Owner rights to it
Avatar of NelsonR

ASKER

So no one knows/has done this?  I've tried Outlook COM objects, MAPI, CDO 1.21, CDOEX, etc. can't figure it out.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ and Refund

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of Mindphaser
Mindphaser

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial