• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 644
  • Last Modified:

Delphi 5 and Standard Office Servers

Hi,
   I'm using Delphi 5 enterprise and office 2000 premium.  I want to add a task item to outlook.  When I drop the TTaskItem component (servers tab) on my form and run it.  I get class not registered.  I understand what this means but how do I register the TTaskItem class.  

p.s.
I've tried reinstalling office.

Cheers
Woody
0
WoodyJ3
Asked:
WoodyJ3
  • 3
  • 2
  • 2
  • +2
1 Solution
 
LischkeCommented:
I tried it myself, but got only the Outlook server to auto attach not the task item. So I'm lurking here and listening...

Ciao, Mike
0
 
topkapiCommented:
are the office automation components build for office2000 or an earlier version? are they compatible with office2000?

(listening)

topkapi
0
 
WoodyJ3Author Commented:
Not sure.  But even if I use the office 2000 type library, and try and create the task item object I still get class not registered.  I'm starting to think this is not a Delphi problem but a Microsoft registration issue.
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
topkapiCommented:
does

CreateOleObject('Word.Application or wather it is called') work?

0
 
LischkeCommented:
I did a search through Dejanews and found that obviously all know that you cannot use the server components with Office 2000. The only way the got it working was to import the type library again. More precisely you need to import the olb file rather than tlb.

Ciao, Mike
0
 
florisbCommented:
copy-pasted some code from old test project (Ole way instead of COM), you don't need the Delphi components for this; just import the Outlook type library (Project | Import type library | create unit)

Works with Outlook 2000, should also work with older versions.




var
/// De variabelen voor de classes.
 FOutlook: OleVariant;
 OutlookTask : TOutlookTask;

//create Outlook with: FOutlook := CreateOleObject('Outlook.Application');


procedure TOutlookTask.OleTask(subject,date: string; HIGHimportance: boolean );
{***********************************************************
pre: outlook is running
discription: create new task with subject, date and importance; save it in folder.
inputs: subject, date, HihjImportance (booelean)
returns: none
***********************************************************}
var
objNS,objDoc : Olevariant;
begin
FOutlook := GetActiveOleObject('Outlook.Application');
objNS:= FOutlook.GetNamespace('MAPI');
objDoc:= FOutlook.CreateItem(olTaskItem);
objDoc.Subject:= subject;
if HIGHImportance then
   objDoc.Importance := olImportanceHigh
else
   objDoc.Importance := olImportanceLow;
objDoc.DueDate := date;
//// et cetera
//// ......
objDoc.Save;
end;


procedure TOutlookTask.OleNew;
{***********************************************************
pre: outlook is running
discription: open new task
inputs: none
returns: none
***********************************************************}
var
objNS, objDoc : Olevariant;
begin
FOutlook := GetActiveOleObject('Outlook.Application');
objNS:= FOutlook.GetNamespace('MAPI');
objDoc:= FOutlook.CreateItem(olTaskItem);
objDoc.Display;
end;


Good luck,
Floris.

ps. can anybody help me with the fight against the databasegrid? See posted question.
0
 
florisbCommented:
errr, you can prob. ship the lines objNS := ....   ;-(
0
 
mscatenaCommented:
You must have a TOutlookApplication and create the item trough it, calling CreateItem. Look at the code to create an email item:

    OutlookApplication1.Connect;
    // This line creates  a item and binds it to a “Server component”. You must cast it too
    MailItem1.ConnectTo(OutlookApplication1.CreateItem(olMailItem) as _DMailItem);
    MailItem1.Recipients.Add(Edit1.Text);
    MailItem1.Subject := Edit2.Text;
    MailItem1.Body := Memo1.Text;
    MailItem1.Send;
0
 
WoodyJ3Author Commented:
Only just read all the above.   Im gonna try it out now.  Stand by.

Cheers
Woody
0
 
WoodyJ3Author Commented:
Spot on mate.  It was the task item I actually wanted so I just changed Mail to Task and hey-presto!!

Cheers
Woody.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now