Outlook SyncObjects in Delphi 5

Is there a way to access Outlook's SyncObjects in Delphi 5?
(I am trying to force the Send/Receive command without opening Outlook. The solutions I have seen that involve accessing Explorer.CommandBars don't seem to work for me).
I have tried:
var
  OutApp   : TOutlookApplication; {placed on the form so instantiated}
  NmSpace : NameSpace;
  K              : LongInt;
begin
  NmSpace := OutApp.GetNamespace('MAPI');
  NmSpace.Logon('', '', False, False);
  for K:=1 to NmSpace.SyncObjects.Count do...
    {compiler says SyncObjects is "undeclared identifier"}
  for K:=1 to OutApp.Session.SyncObjects.Count do...
   {compiler says Session is "undeclared identifier"}
end;

I have found people on-line saying both of these ways of accessing SyncObjects, but I suspect they are using later versions of Delphi than Delphi 5.
OnionsingerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jimyXCommented:
>   "SyncObjects & Session is "undeclared identifier""

It could be a shortage in D5. Your code works just fine in D7. I do not have D5 to try that.

Another way and also works fine in D7:
uses ComObj;
...
var
  OutApp, NmSpace : OLEVariant;
  K : LongInt;
begin
  OutApp := CreateOleObject('outlook.application');
  NmSpace := OutApp.GetNamespace('MAPI');
  NmSpace.Logon('', '', False, False);
  for K:=1 to NmSpace.SyncObjects.Count do...
    {compiler says SyncObjects is "undeclared identifier"}
  for K:=1 to OutApp.Session.SyncObjects.Count do...
   {compiler says Session is "undeclared identifier"}
  NmSpace := Unassigned;
  OutApp := Unassigned;
end;

Open in new window


You may try OfficePartner in case it solves the problem:
http://sourceforge.net/projects/tpofficepartner/

But I think upgrading to a newer version of Delphi is going to help you programming better.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OnionsingerAuthor Commented:
Thank you for the comment, but I don't plan to upgrade to Delphi 7.  I am trying to find out if there is a way to achieve this using Delphi 5.
0
jimyXCommented:
Will try to help as much as I can, but I do not have D5 to test.

Please check the units included in your project, and make sure to include "Outlook8" in the uses clause.

For more information about using Outlook in D5 refer to this page:
http://www.djpate.freeserve.co.uk/AutoOutl.htm
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

OnionsingerAuthor Commented:
Outlook8 is in my uses clause.
I already read the page you linked to, but it doesn't cover the topic of SyncObjects.
0
jimyXCommented:
Could be shortage in D5. Because since you did include all the necessary units to your project and it's still not identified, then that means D5 lacks some objects.
0
OnionsingerAuthor Commented:
It turns out that using:
try
  Outlook:=GetActiveOleOjbect('Outlook.Application')
except
  Outlook := CreateOleObject('Outlook.Application');
end;
 (instead of placing a TOutlookApplication on the form)
NmSpace:=Outlook.GetNameSpace('MAPI')
allows me to then access NmSpace.SyncObjects
even in Delphi 5 so this solves the problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.