I have Delphi 3 and a runtime error occurs when I RUN this project. No build errors...
The form appears correctly and I put the path to the GroupWise domain directory :
F:\opt\novell\groupwise\mail\dom1
I click on the CONNECT button and the error is :
"Project admin_api.exe raised an exception class EOleSysError with message 'Invalid class string'. Process stopped. Use Step or Run to Continue"
For Delphi XE the error is only "Invalid class string".
What am I doing wrong ?
Thank You
Have downloaded the same GroupWise Administrative Object API code
https://www.novell.com/developer/ndk...bject_api.html
{/************************************************** *************************
************************************************** **************************/}
unit App_obj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleAuto, Ole2;
type
TForm1 = class(TForm)
Button1: TButton;
Label6: TLabel;
UserID: TEdit;
Label7: TLabel;
LastName: TEdit;
Label8: TLabel;
FirstName: TEdit;
UserDistinguishedName: TEdit;
Label10: TLabel;
SystemInfo: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
SystemDescription: TEdit;
SystemDistinguishedName: TEdit;
SystemLastModifiedBy: TEdit;
ConnectedDomainName: TEdit;
SystemObjectID: TEdit;
PostOfficeList: TComboBox;
Label11: TLabel;
Label9: TLabel;
UserContext: TEdit;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
DomainPath: TEdit;
Button2: TButton;
procedure Initialize(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
vSystem:variant;
vDomain:variant;
const
ADMIN_NAME = 'Admin';
sDOT = '.';
implementation
{$R *.DFM}
procedure TForm1.Initialize(Sender: TObject);
begin
//Initialize controls
DomainPath.Text:='';
SystemDescription.Text:='';
SystemDistinguishedName.Text:='';
SystemLastModifiedBy.Text:='';
ConnectedDomainName.Text:='';
SystemObjectID.Text:='';
UserID.Text:='';
LastName.Text:='';
FirstName.Text:='';
UserDistinguishedName.Text:='';
UserContext.Text:='';
UserID.SetFocus;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
vUsers:variant;
vUser:variant;
stemp:string;
idotpos:integer;
SelectedPO:string;
sAdmin:string;
begin
//Get Selected PostOffice
SelectedPO:=PostOfficeList.Items[PostOfficeList.ItemIndex];
//Get Users Object
vUsers:=vDomain.Users;
//Find Admin user object
vUser:=vUsers.Item(ADMIN_NAME,SelectedPO,Connected DomainName.Text);
If UserContext.Text = '' then begin
//Get Admin Context and use as Default
sAdmin:=vUser.NetID;
idotpos:=Pos(sDOT,sAdmin);
stemp:=Copy(sAdmin,idotpos,256); //Copy everything after first dot include dot
UserContext.Text:=stemp;
end else begin
//Use context string
stemp:=UserContext.Text;
end;
//Make Distinguished name by adding UserID and admin context
stemp:=UserID.Text+stemp;
//Display User distinguished name
UserDistinguishedName.Text:=stemp;
//Add user
vUser:=vUsers.Add(UserID.Text,LastName.Text,stemp,
'',SelectedPO);
//Set User first name
vUser.GivenName:=FirstName.Text;
//Commit User first name to system
vUser.Commit;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
vPostOffice:variant;
vPostOffices:variant;
vPOIterator:variant;
begin
//Get GroupWise Admin Object and connect to it
if(DomainPath.Text = '') then begin
ShowMessage('You must enter a valid Domain Path. Then press Login');
exit;
end;
vSystem:=CreateOleObject('NovellGroupWareAdmin');
vSystem.Connect(DomainPath.Text);
//Get the connected Domain
vDomain:=vSystem.ConnectedDomain;
//List some Domain properties
SystemDescription.Text:=vDomain.Description;
SystemDistinguishedName.Text:=vDomain.Distinguishe dName;
SystemLastModifiedBy.Text:=vDomain.LastModifiedBy;
ConnectedDomainName.Text:=vDomain.Name;
SystemObjectID.Text:=vDomain.ObjectID;
//Initialize controls
UserID.Text:='';
LastName.Text:='';
FirstName.Text:='';
UserDistinguishedName.Text:='';
UserContext.Text:='';
UserID.SetFocus;
//Get list of PostOffices for connected Domain
vPostOffices:=vDomain.PostOffices;
vPOIterator:=vPostOffices.CreateIterator;
vPostOffice:=vPOIterator.Next;
PostOfficeList.Clear;
While( (NOT VarIsNULL(vPostOffice)) And (NOT varisempty(vPostOffice))) do begin
PostOfficeList.Items.Add(vPostOffice.Name);
vPostOffice:=vPOIterator.Next;
end;
//Set index to first item in list
PostOfficeList.ItemIndex:=0;
end;
end.
The form appears correctly and I put the path to the GroupWise domain directory :
F:\opt\novell\groupwise\mail\dom1
I click on the CONNECT button and the error is :
"Project admin_api.exe raised an exception class EOleSysError with message 'Invalid class string'. Process stopped. Use Step or Run to Continue"
For Delphi XE the error is only "Invalid class string".
What am I doing wrong ?
Thank You
Have downloaded the same GroupWise Administrative Object API code
https://www.novell.com/developer/ndk...bject_api.html
{/************************************************** *************************
************************************************** **************************/}
unit App_obj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleAuto, Ole2;
type
TForm1 = class(TForm)
Button1: TButton;
Label6: TLabel;
UserID: TEdit;
Label7: TLabel;
LastName: TEdit;
Label8: TLabel;
FirstName: TEdit;
UserDistinguishedName: TEdit;
Label10: TLabel;
SystemInfo: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
SystemDescription: TEdit;
SystemDistinguishedName: TEdit;
SystemLastModifiedBy: TEdit;
ConnectedDomainName: TEdit;
SystemObjectID: TEdit;
PostOfficeList: TComboBox;
Label11: TLabel;
Label9: TLabel;
UserContext: TEdit;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
DomainPath: TEdit;
Button2: TButton;
procedure Initialize(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
vSystem:variant;
vDomain:variant;
const
ADMIN_NAME = 'Admin';
sDOT = '.';
implementation
{$R *.DFM}
procedure TForm1.Initialize(Sender: TObject);
begin
//Initialize controls
DomainPath.Text:='';
SystemDescription.Text:='';
SystemDistinguishedName.Text:='';
SystemLastModifiedBy.Text:='';
ConnectedDomainName.Text:='';
SystemObjectID.Text:='';
UserID.Text:='';
LastName.Text:='';
FirstName.Text:='';
UserDistinguishedName.Text:='';
UserContext.Text:='';
UserID.SetFocus;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
vUsers:variant;
vUser:variant;
stemp:string;
idotpos:integer;
SelectedPO:string;
sAdmin:string;
begin
//Get Selected PostOffice
SelectedPO:=PostOfficeList.Items[PostOfficeList.ItemIndex];
//Get Users Object
vUsers:=vDomain.Users;
//Find Admin user object
vUser:=vUsers.Item(ADMIN_NAME,SelectedPO,Connected DomainName.Text);
If UserContext.Text = '' then begin
//Get Admin Context and use as Default
sAdmin:=vUser.NetID;
idotpos:=Pos(sDOT,sAdmin);
stemp:=Copy(sAdmin,idotpos,256); //Copy everything after first dot include dot
UserContext.Text:=stemp;
end else begin
//Use context string
stemp:=UserContext.Text;
end;
//Make Distinguished name by adding UserID and admin context
stemp:=UserID.Text+stemp;
//Display User distinguished name
UserDistinguishedName.Text:=stemp;
//Add user
vUser:=vUsers.Add(UserID.Text,LastName.Text,stemp,
'',SelectedPO);
//Set User first name
vUser.GivenName:=FirstName.Text;
//Commit User first name to system
vUser.Commit;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
vPostOffice:variant;
vPostOffices:variant;
vPOIterator:variant;
begin
//Get GroupWise Admin Object and connect to it
if(DomainPath.Text = '') then begin
ShowMessage('You must enter a valid Domain Path. Then press Login');
exit;
end;
vSystem:=CreateOleObject('NovellGroupWareAdmin');
vSystem.Connect(DomainPath.Text);
//Get the connected Domain
vDomain:=vSystem.ConnectedDomain;
//List some Domain properties
SystemDescription.Text:=vDomain.Description;
SystemDistinguishedName.Text:=vDomain.Distinguishe dName;
SystemLastModifiedBy.Text:=vDomain.LastModifiedBy;
ConnectedDomainName.Text:=vDomain.Name;
SystemObjectID.Text:=vDomain.ObjectID;
//Initialize controls
UserID.Text:='';
LastName.Text:='';
FirstName.Text:='';
UserDistinguishedName.Text:='';
UserContext.Text:='';
UserID.SetFocus;
//Get list of PostOffices for connected Domain
vPostOffices:=vDomain.PostOffices;
vPOIterator:=vPostOffices.CreateIterator;
vPostOffice:=vPOIterator.Next;
PostOfficeList.Clear;
While( (NOT VarIsNULL(vPostOffice)) And (NOT varisempty(vPostOffice))) do begin
PostOfficeList.Items.Add(vPostOffice.Name);
vPostOffice:=vPOIterator.Next;
end;
//Set index to first item in list
PostOfficeList.ItemIndex:=0;
end;
end.