Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Use Outlook COM objects from shared profile/Install MAPI

Posted on 2002-06-06
9
497 Views
Last Modified: 2010-04-04
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.
0
Comment
Question by:NelsonR
9 Comments
 
LVL 4

Expert Comment

by:StevenB
ID: 7061064
 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
0
 

Author Comment

by:NelsonR
ID: 7062126
Where do you select it specifically?  I couldn't find it anywhere.  Also, cdolive is outdated :(
0
 
LVL 4

Expert Comment

by:StevenB
ID: 7063904
 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.
 
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:NelsonR
ID: 7066946
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)?
0
 

Author Comment

by:NelsonR
ID: 7067021
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.
0
 

Author Comment

by:NelsonR
ID: 7067166
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
0
 

Author Comment

by:NelsonR
ID: 7070956
So no one knows/has done this?  I've tried Outlook COM objects, MAPI, CDO 1.21, CDOEX, etc. can't figure it out.
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9010474
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
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 9101878
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
add combobox item based on numbers 9 154
RESTRequest Parameter 4 41
Delphi problems to abort a printjob 9 24
Delphi: sending SMS on android platform 1 32
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question