mimason Absent Member.
Absent Member.
5453 views

Create Resource in GW

So.. I can create users and distribution lists but resources are resisting me.
Has anyone got resources.add to work in VB.Net?

I'm receiving "an invalid argument was passed to the function call." and I'm just at a loss at what else to try. I've reviewed the example application and I'm not too far from it except for the vb version difference. I'm coping the distinguished name verbatim..

objResource = objResources.Add("TestResource","TestResource.GW.0.CHP", objUser)

objUser is a AdminTypeLibrary.User, and I verified that the objects set and usable.. No duplicate entries... I've tried the optional bits with objects and strings but no help... All i can guess now is that GWResourceID is something different..

Anyone have ideas?
Labels (1)
0 Likes
12 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Create Resource in GW

mimason wrote:
> So.. I can create users and distribution lists but resources are
> resisting me.
> Has anyone got resources.add to work in VB.Net?
>
> I'm receiving "an invalid argument was passed to the function call."
> and I'm just at a loss at what else to try. I've reviewed the example
> application and I'm not too far from it except for the vb version
> difference. I'm coping the distinguished name verbatim..
>
> objResource = objResources.Add("TestResource","TestResource.GW.0.CHP",
> objUser)
>
> objUser is a AdminTypeLibrary.User, and I verified that the objects set
> and usable.. No duplicate entries... I've tried the optional bits with
> objects and strings but no help... All i can guess now is that
> GWResourceID is something different..
>
> Anyone have ideas?
>
>

Instead of quoting a sample, provide a complete 20 line (from connection
to your problem) piece of code. Add additional tests:

For eample demonstrate that both connect and connectbydn work.
Demonstrate you can contact to an existing Resource, both by
ItemByOBjectId, and by iteration
0 Likes
mimason Absent Member.
Absent Member.

Re: Create Resource in GW

didn't really want to clean up the extraneous crap..


Dim PO, Dom As String
Dim objDomain, objDoms, objDom, objPOs, objPO, objCurPO, objDistro, MailboxID As Object
Dim objUser As AdminTypeLibrary.User
Dim objResources As AdminTypeLibrary.Resources
Dim objResource As AdminTypeLibrary.Resource
Dim DomPath As String = "U:\gwisedo\Domains\WPDOMAIN.DB"
Dim objAdminSystem As Object
objAdminSystem = CreateObject("NovellGroupWareAdmin") '<------------fails here per error, but works when running it in the VS2005 environment
objDomain = objAdminSystem.Connect("w:\GWISEDO") '"T:\GRPWISE\DOMAIN")

objDom = objAdminSystem.domains.itembydn("DOCHP.0.CHP")
objPO = objAdminSystem.postoffices.item("POCHP", objDom)

objUser = objAdminSystem.Users.item("t04198", "POHQD0", "DOHQD0") ' works
objResources = objAdminSystem.Resources
objResource = objResources.CreateIterator.Next 'works
Dim resName As String = "testResource"
Dim scontext As String = "testResource.GW.0.CHP"
'objResource = objResources.Add("", "test" & objUser.DistinguishedName, objUser) 'does not work
'objResource = objResources.Add("", "test" & objUser.DistinguishedName, objUser, "zzz", objPO, objDom) ' does not work
'objResource = objResources.Add(objResource.Name, objResource.DistinguishedName, objUser) ' you'd expect a conflict error, but just fails same as others
objResources.Add("testResName", "testResName.GW.0.CHP", objUser)
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Create Resource in GW

Reread the ENTIRE DOC page under RESOURCES, from top to bottom. If you
still can't get it working, see the next message


mimason wrote:
> didn't really want to clean up the extraneous crap..
>
>
> Dim PO, Dom As String
> Dim objDomain, objDoms, objDom, objPOs, objPO, objCurPO,
> objDistro, MailboxID As Object
> Dim objUser As AdminTypeLibrary.User
> Dim objResources As AdminTypeLibrary.Resources
> Dim objResource As AdminTypeLibrary.Resource
> Dim DomPath As String = "U:\gwisedo\Domains\WPDOMAIN.DB"
> Dim objAdminSystem As Object
> objAdminSystem = CreateObject("NovellGroupWareAdmin")
> '<------------fails here per error, but works when running it in the
> VS2005 environment
> objDomain = objAdminSystem.Connect("w:\GWISEDO")
> '"T:\GRPWISE\DOMAIN")
>
> objDom = objAdminSystem.domains.itembydn("DOCHP.0.CHP")
> objPO = objAdminSystem.postoffices.item("POCHP", objDom)
>
> objUser = objAdminSystem.Users.item("t04198", "POHQD0",
> "DOHQD0") ' works
> objResources = objAdminSystem.Resources
> objResource = objResources.CreateIterator.Next 'works
> Dim resName As String = "testResource"
> Dim scontext As String = "testResource.GW.0.CHP"
> 'objResource = objResources.Add("", "test" &
> objUser.DistinguishedName, objUser) 'does not work
> 'objResource = objResources.Add("", "test" &
> objUser.DistinguishedName, objUser, "zzz", objPO, objDom) ' does not
> work
> 'objResource = objResources.Add(objResource.Name,
> objResource.DistinguishedName, objUser) ' you'd expect a conflict error,
> but just fails same as others
> objResources.Add("testResName", "testResName.GW.0.CHP",
> objUser)
>
>

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Create Resource in GW

Michael Bell wrote:
> Reread the ENTIRE DOC page under RESOURCES, from top to bottom. If you
> still can't get it working, see the next message
>
>
> mimason wrote:
>> didn't really want to clean up the extraneous crap..
>>
>>
>> Dim PO, Dom As String
>> Dim objDomain, objDoms, objDom, objPOs, objPO, objCurPO,
>> objDistro, MailboxID As Object
>> Dim objUser As AdminTypeLibrary.User
>> Dim objResources As AdminTypeLibrary.Resources
>> Dim objResource As AdminTypeLibrary.Resource
>> Dim DomPath As String = "U:\gwisedo\Domains\WPDOMAIN.DB"
>> Dim objAdminSystem As Object
>> objAdminSystem = CreateObject("NovellGroupWareAdmin")
>> '<------------fails here per error, but works when running it in the
>> VS2005 environment
>> objDomain = objAdminSystem.Connect("w:\GWISEDO")
>> '"T:\GRPWISE\DOMAIN")
>>
>> objDom = objAdminSystem.domains.itembydn("DOCHP.0.CHP")
>> objPO = objAdminSystem.postoffices.item("POCHP", objDom)
>>
>> objUser = objAdminSystem.Users.item("t04198", "POHQD0",
>> "DOHQD0") ' works
>> objResources = objAdminSystem.Resources
>> objResource = objResources.CreateIterator.Next 'works
>> Dim resName As String = "testResource"
>> Dim scontext As String = "testResource.GW.0.CHP"
>> 'objResource = objResources.Add("", "test" &
>> objUser.DistinguishedName, objUser) 'does not work
>> 'objResource = objResources.Add("", "test" &
>> objUser.DistinguishedName, objUser, "zzz", objPO, objDom) ' does not
>> work
>> 'objResource = objResources.Add(objResource.Name,
>> objResource.DistinguishedName, objUser) ' you'd expect a conflict error,
>> but just fails same as others
>> objResources.Add("testResName", "testResName.GW.0.CHP",
>> objUser)
>>
>>





did you reallly try?








































ok

On my test system, using simple vbscript the following fails


dim objAdminSystem
set objAdminSystem = CreateObject("NovellGroupWareAdmin")
dim objDomain
setobjDomain = objAdminSystem.Connect("c:\pri")
dim objResources
set objResources = objAdminSystem.Resources
dim objUsers
set objUsers =objAdminSystem.Users
dim objUser
set objUser= objUsers.Item("jallchin","po","primary")
Wscript.echo(objUser.DistinguishedName)
dim objResource
set objResource=objResources.Add("testResName",

"turniphead.beginfinite",objUser)





and













the following works


dim objAdminSystem
set objAdminSystem = CreateObject("NovellGroupWareAdmin")
dim objDomain
setobjDomain = objAdminSystem.Connect("c:\pri")
dim objResources
set objResources = objAdminSystem.Resources
dim objUsers
set objUsers =objAdminSystem.Users
dim objUser
set objUser= objUsers.Item("jallchin","po","primary")
Wscript.echo(objUser.DistinguishedName)
dim objResource
set objResource=objResources.Add("testResName",

"turniphead.beginfinite",objUser,,"po","primary")



That's right. It looks like you didn't read the part of the docs
explaining that dependent on where the objResources was garnered from,
you'll have to supply the po and dom name

Of course, you can fill it in from the User if you want it there...


0 Likes
mimason Absent Member.
Absent Member.

Re: Create Resource in GW

Well, thanks for the **** sure attitude. I'm afraid you either couldn't read my posted code, didn't read it, or just couldn't understand it.

Obviously the following line doesn't mention Post office or domain. Or does it?
objResource = objResources.Add("", "test" & objUser.DistinguishedName, objUser, "zzz", objPO, objDom) 

In any event, sending a string or a object caused the same error.
You're simple lill vb script returns *gasp* the same error.
and I re-quote...
"An invalid argument was passed in the function call."
If you where to forget something the error would be:
"Wrong number of arguments or invalid property assignment"

By the way, if you read that same document I did, you'd recognize that post office and domain where OPTIONAL (signified by them square brackets)... Just a GroupWise lesson here... You don't get a choice what post office the resource goes to because it'll be going to the same post office as the user provided, it just saves the API code from figuring it out for you.


I will thank you for nailing the coffin shut on getting good support off this forum. It's becoming apparent that there are too many **** sure tolls trying to get their rocks off here.

Politeness... I guess you put it best...
did you reallly try?


-Mike
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Create Resource in GW

Until I added the extra arguments I got the same error message you did.
When I added them all was perfect. Did you try my code?

I did miss your line performing a similar function. Sorry. You posted a
very hard to read output. I posted my response the way I did because I
was attempting to be pedagical - to allow you to think about the issue
before giving the answer (which I did)

However I note a crucial set of distinctions:

1. I passed STRINGS as the po and domain, you are passing the main objects.
2. You pass an empty string for the name of the resource, I pass
testresname.

My code follows

dim objAdminSystem
set objAdminSystem = CreateObject("NovellGroupWareAdmin")
dim objDomain
setobjDomain = objAdminSystem.Connect("c:\pri")
dim objResources
set objResources = objAdminSystem.Resources
dim objUsers
set objUsers =objAdminSystem.Users
dim objUser
set objUser= objUsers.Item("jallchin","po","primary")
Wscript.echo(objUser.DistinguishedName)
dim objResource
set objResource=objResources.Add("testResName",

"turniphead.beginfinite",objUser)




mimason wrote:
> Well, thanks for the **** sure attitude. I'm afraid you either couldn't
> read my posted code, didn't read it, or just couldn't understand it.
>
> Obviously the following line doesn't mention Post office or domain. Or
> does it?
>
> Code:
> --------------------
> objResource = objResources.Add("", "test" & objUser.DistinguishedName, objUser, "zzz", objPO, objDom)
> --------------------
>
> In any event, sending a string or a object caused the same error.
> You're simple lill vb script returns *gasp* the same error.
> and I re-quote...
> "An invalid argument was passed in the function call."
> If you where to forget something the error would be:
> "Wrong number of arguments or invalid property assignment"
>
> By the way, if you read that same document I did, you'd recognize that
> post office and domain where OPTIONAL (signified by them square
> brackets)... Just a GroupWise lesson here... You don't get a choice
> what post office the resource goes to because it'll be going to the same
> post office as the user provided, it just saves the API code from
> figuring it out for you.
>
>
> I will thank you for nailing the coffin shut on getting good support
> off this forum. It's becoming apparent that there are too many ****
> sure tolls trying to get their rocks off here.
>
> Politeness... I guess you put it best...
>> did you reallly try?

>
> -Mike
>
>
> +----------------------------------------------------------------------+
> |Filename: untitled.JPG |
> |Download: http://forums.novell.com/attachment.php?attachmentid=2881 |
> +----------------------------------------------------------------------+
>

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Create Resource in GW

Your abruptness of response made me not read your latest response
either. Dude there are TWO examples of code in my original response. One
works and one doesn't

This one works for me with CSCRIPT test.vbs

>
> My code follows
>
> dim objAdminSystem
> set objAdminSystem = CreateObject("NovellGroupWareAdmin")
> dim objDomain
> setobjDomain = objAdminSystem.Connect("c:\pri")
> dim objResources
> set objResources = objAdminSystem.Resources
> dim objUsers
> set objUsers =objAdminSystem.Users
> dim objUser
> set objUser= objUsers.Item("jallchin","po","primary")
> Wscript.echo(objUser.DistinguishedName)
> dim objResource
> set objResource=objResources.Add("testResName",
>
> "turniphead.beginfinite",objUser)




Michael Bell wrote:
> Until I added the extra arguments I got the same error message you did.
> When I added them all was perfect. Did you try my code?
>
> I did miss your line performing a similar function. Sorry. You posted a
> very hard to read output. I posted my response the way I did because I
> was attempting to be pedagical - to allow you to think about the issue
> before giving the answer (which I did)
>
> However I note a crucial set of distinctions:
>
> 1. I passed STRINGS as the po and domain, you are passing the main objects.
> 2. You pass an empty string for the name of the resource, I pass
> testresname.
>
> My code follows
>
> dim objAdminSystem
> set objAdminSystem = CreateObject("NovellGroupWareAdmin")
> dim objDomain
> setobjDomain = objAdminSystem.Connect("c:\pri")
> dim objResources
> set objResources = objAdminSystem.Resources
> dim objUsers
> set objUsers =objAdminSystem.Users
> dim objUser
> set objUser= objUsers.Item("jallchin","po","primary")
> Wscript.echo(objUser.DistinguishedName)
> dim objResource
> set objResource=objResources.Add("testResName",
>
> "turniphead.beginfinite",objUser)
>
>
>
>
> mimason wrote:
>> Well, thanks for the **** sure attitude. I'm afraid you either couldn't
>> read my posted code, didn't read it, or just couldn't understand it.
>> Obviously the following line doesn't mention Post office or domain. Or
>> does it?
>> Code:
>> --------------------
>> objResource = objResources.Add("", "test" &
>> objUser.DistinguishedName, objUser, "zzz", objPO, objDom)
>> --------------------
>>
>> In any event, sending a string or a object caused the same error.
>> You're simple lill vb script returns *gasp* the same error.
>> and I re-quote...
>> "An invalid argument was passed in the function call."
>> If you where to forget something the error would be:
>> "Wrong number of arguments or invalid property assignment"
>>
>> By the way, if you read that same document I did, you'd recognize that
>> post office and domain where OPTIONAL (signified by them square
>> brackets)... Just a GroupWise lesson here... You don't get a choice
>> what post office the resource goes to because it'll be going to the same
>> post office as the user provided, it just saves the API code from
>> figuring it out for you.
>>
>>
>> I will thank you for nailing the coffin shut on getting good support
>> off this forum. It's becoming apparent that there are too many ****
>> sure tolls trying to get their rocks off here.
>> Politeness... I guess you put it best...
>>> did you reallly try?

>>
>> -Mike
>>
>>
>> +----------------------------------------------------------------------+
>> |Filename: untitled.JPG |
>> |Download: http://forums.novell.com/attachment.php?attachmentid=2881 |
>> +----------------------------------------------------------------------+
>>

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Create Resource in GW

Although this fellow seems to have left, let me correct my posting, as I
posted the not-working one in that last. Both were in the originaal answer.

This one works


dim objAdminSystem
set objAdminSystem = CreateObject("NovellGroupWareAdmin")
dim objDomain
setobjDomain = objAdminSystem.Connect("c:\pri")
dim objResources
set objResources = objAdminSystem.Resources
dim objUsers
set objUsers =objAdminSystem.Users
dim objUser
set objUser= objUsers.Item("jallchin","po","primary")
Wscript.echo(objUser.DistinguishedName)
dim objResource
set objResource=objResources.Add("testResName",

"turniphead.beginfinite",objUser,,"po","primary")
0 Likes
mimason Absent Member.
Absent Member.

Re: Create Resource in GW

Sorry for the frustration, I'd tried every combo and change I could think of and my time is rather locked up with managers breathing down my throat for progress.
However I just got it working after reviewing some other forum posts.. Specifically the "Create nickname, unknown error" posts.

Turns out that the primary domain I use for console one didn't match with the one I needed to be using. So after mapping another drive, pointing to my domain bang it all works.

I do have to say, this is a true pain in the ass because we have far too many domains.. but that the way our admin set us up, its our issue, and we're planning to clean it up.

It's also a bit frustrating that creating a user and creating a resource didn't have the same requirements (IE connected to the same domain).

Quite frustrating.

-Mike
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Create Resource in GW

mimason wrote:
> Sorry for the frustration, I'd tried every combo and change I could
> think of and my time is rather locked up with managers breathing down my
> throat for progress.
> However I just got it working after reviewing some other forum posts..
> Specifically the "Create nickname, unknown error" posts.
>
> Turns out that the primary domain I use for console one didn't match
> with the one I needed to be using. So after mapping another drive,
> pointing to my domain bang it all works.
>
> I do have to say, this is a true pain in the ass because we have far
> too many domains.. but that the way our admin set us up, its our issue,
> and we're planning to clean it up.
>
> It's also a bit frustrating that creating a user and creating a
> resource didn't have the same requirements (IE connected to the same
> domain).
>
> Quite frustrating.
>
> -Mike
>
>

I am glad you got it working. I was going to suggest you look at that
thread, but you seemed a little too upset to contact 🙂
0 Likes
gallwapa Absent Member.
Absent Member.

Re: Create Resource in GW

This is why I love newsgroups/forums - my post helped someone else fix up their issue too 🙂


>>> Michael Bell<mikebell90@no-mx.forums.novell.com> 6/17/2009 7:06 PM >>>

mimason wrote:
> Sorry for the frustration, I'd tried every combo and change I could
> think of and my time is rather locked up with managers breathing down my
> throat for progress.
> However I just got it working after reviewing some other forum posts..
> Specifically the "Create nickname, unknown error" posts.
>
> Turns out that the primary domain I use for console one didn't match
> with the one I needed to be using. So after mapping another drive,
> pointing to my domain bang it all works.
>
> I do have to say, this is a true pain in the ass because we have far
> too many domains.. but that the way our admin set us up, its our issue,
> and we're planning to clean it up.
>
> It's also a bit frustrating that creating a user and creating a
> resource didn't have the same requirements (IE connected to the same
> domain).
>
> Quite frustrating.
>
> -Mike
>
>

I am glad you got it working. I was going to suggest you look at that
thread, but you seemed a little too upset to contact 🙂
0 Likes
testowy_email Absent Member.
Absent Member.

Re: Create Resource in GW

I'm facing the same problem it this moment so I would like to ask if there is some way to create a Resource in some domain when I'm connected to a different one?

use Win32::OLE;

$gw=Win32::OLE->new('NovellGroupWareAdmin');

//1. $gw->Connect("E:\\groupwise\\domains");
//2. $gw->Connect("E:\\groupwise\\domeny\\druga");

$user = $gw->Users->Item("user", "drugi_po", "druga");
$domain = $gw->Domains->Item("druga");
$po = $domain->PostOffices->Item("drugi_po");

#Combintions:
#$gw->Resources->Add("resName", "resName.resources.test", $user, "asd", "drugi_po", "druga");
#$domain->Resources->Add("resName", "resName.resources.test, $user, "asd", "drugi_po", );
#$po->Resources->Add("resName", "resName.resources.test", $user);


When line 1 is not commented the application throws an error
When line 1 is commented and line 2 is not commented all combinations are working
When line 1 and line 2 is not commented - app throws "Already connected" exception

(code in Perl)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.