gallwapa Absent Member.
Absent Member.
2854 views

Admin Object API - Create Nickname - An unknown error occurred

Hi all,

We're trying to remove all aliases and create nicknames for them instead. I
realize the alias part can't be done via the Admin Object API (grrrrr!!!!!)
but at least the nickname piece can. I can add a new users, however, I am
not able to add nicknames. I am receiving "An unknown error occurred".

[STAThread]
static void Main(string[] args)
{
try
{
AdminTypeLibrary.System GWSystem = new
AdminTypeLibrary.System();
string strPath = @"\\fs\vol1\gw\dom\primary ( file://\fs)";
GWSystem.Connect(strPath);
AdminTypeLibrary.AdminObject ao =
(AdminTypeLibrary.AdminObject)GWSystem.Users.Item("gall", "PO1",
"Primary");
Console.WriteLine(ao.Name);
GWSystem.Nicknames.Add("testgall1234",
ao,ao.PostOffice,ao.Domain);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}


When I try to supply strings like so

GWSystem.Nicknames.Add("testgall1234", ao,"PO1","Primary");


as documented at
http://developer.novell.com/documentation/gwadmin/gwadmenu/data/hr1myg2u.htm
l I receive "An invalid argument was passed in the function call"




On another note, can the Groupwise API Gateway do a bulk-remove of all
aliases? I really was trying to avoid installing it(I hate the way it works
with its voodoo text file monitor) but we have about 3000 aliases to
remove.


Labels (1)
0 Likes
5 Replies
gallwapa Absent Member.
Absent Member.

Re: Admin Object API - Create Nickname - An unknown error occurred

Ignore (file://\fs) - it was an error in converting to plain text from html
for posting

>>> Preston Gallwas<GallwaPA@puyallup.k12.wa.us> 5/28/2009 8:27 AM >>>

Hi all,

We're trying to remove all aliases and create nicknames for them instead.
I
realize the alias part can't be done via the Admin Object API (grrrrr!!!!!)
but at least the nickname piece can. I can add a new users, however, I am
not able to add nicknames. I am receiving "An unknown error occurred".

[STAThread]
static void Main(string[] args)
{
try
{
AdminTypeLibrary.System GWSystem = new
AdminTypeLibrary.System();
string strPath = @"\\fs\vol1\gw\dom\primary ( file://\fs)";
GWSystem.Connect(strPath);
AdminTypeLibrary.AdminObject ao =
(AdminTypeLibrary.AdminObject)GWSystem.Users.Item("gall", "PO1",
"Primary");
Console.WriteLine(ao.Name);
GWSystem.Nicknames.Add("testgall1234",
ao,ao.PostOffice,ao.Domain);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}


When I try to supply strings like so

GWSystem.Nicknames.Add("testgall1234", ao,"PO1","Primary");


as documented at
http://developer.novell.com/documentation/gwadmin/gwadmenu/data/hr1myg2u.htm

l I receive "An invalid argument was passed in the function call"




On another note, can the Groupwise API Gateway do a bulk-remove of all
aliases? I really was trying to avoid installing it(I hate the way it
works
with its voodoo text file monitor) but we have about 3000 aliases to
remove.




0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Admin Object API - Create Nickname - An unknown error occurred

I created a bug to track the problem.
You might try posting something on the gwadmin
forum to see if anyone has seen the problem or
has a work around.

Preston

>>> On Thursday, May 28, 2009 at 9:42 AM, Preston

Gallwas<GallwaPA@puyallup.k12.wa.us> wrote:
> Ignore (file://\fs) ‑ it was an error in converting to plain text from

html
> for posting
>
>>>> Preston Gallwas<GallwaPA@puyallup.k12.wa.us> 5/28/2009 8:27 AM >>>

> Hi all,
>
> We're trying to remove all aliases and create nicknames for them instead.


> I
> realize the alias part can't be done via the Admin Object API

(grrrrr!!!!!)
> but at least the nickname piece can. I can add a new users, however, I

am
> not able to add nicknames. I am receiving "An unknown error occurred".
>
> [STAThread]
> static void Main(string[] args)
> {
> try
> {
> AdminTypeLibrary.System GWSystem = new
> AdminTypeLibrary.System();
> string strPath = @"\\fs\vol1\gw\dom\primary (

file://\fs)";
> GWSystem.Connect(strPath);
> AdminTypeLibrary.AdminObject ao =
> (AdminTypeLibrary.AdminObject)GWSystem.Users.Item("gall", "PO1",
> "Primary");
> Console.WriteLine(ao.Name);
> GWSystem.Nicknames.Add("testgall1234",
> ao,ao.PostOffice,ao.Domain);
> }
> catch (Exception ex)
> {
> Console.WriteLine(ex.ToString());
> }
> }
>
>
> When I try to supply strings like so
>
> GWSystem.Nicknames.Add("testgall1234", ao,"PO1","Primary");
>
>
> as documented at
>

http://developer.novell.com/documentation/gwadmin/gwadmenu/data/hr1myg2u.htm

>
> l I receive "An invalid argument was passed in the function call"
>
>
>
>
> On another note, can the Groupwise API Gateway do a bulk‑remove of all
> aliases? I really was trying to avoid installing it(I hate the way it
> works
> with its voodoo text file monitor) but we have about 3000 aliases to
> remove.

0 Likes
gallwapa Absent Member.
Absent Member.

Re: Admin Object API - Create Nickname - An unknown error occurred

When you say the gwadmin forum do you mean the install-setup-admin newsgroup or something else?

More information on this: I discovered there is an alias migration utility that will convert them to preferred e-mail addresses which I can then set to null. My only hangup now is this nickname thing. Still hung on unknown error.

>>> Preston Stephenson<PStephenson@gw.novell.com> 6/1/2009 4:16 AM >>>

I created a bug to track the problem.
You might try posting something on the gwadmin
forum to see if anyone has seen the problem or
has a work around.

Preston

>>> On Thursday, May 28, 2009 at 9:42 AM, Preston

Gallwas<GallwaPA@puyallup.k12.wa.us> wrote:
> Ignore (file://\fs) - it was an error in converting to plain text from

html
> for posting
>
>>>> Preston Gallwas<GallwaPA@puyallup.k12.wa.us> 5/28/2009 8:27 AM >>>

> Hi all,
>
> We're trying to remove all aliases and create nicknames for them instead.


> I
> realize the alias part can't be done via the Admin Object API

(grrrrr!!!!!)
> but at least the nickname piece can. I can add a new users, however, I

am
> not able to add nicknames. I am receiving "An unknown error occurred".
>
> [STAThread]
> static void Main(string[] args)
> {
> try
> {
> AdminTypeLibrary.System GWSystem = new
> AdminTypeLibrary.System();
> string strPath = @"\\fs\vol1\gw\dom\primary (

file://\fs)";
> GWSystem.Connect(strPath);
> AdminTypeLibrary.AdminObject ao =
> (AdminTypeLibrary.AdminObject)GWSystem.Users.Item("gall", "PO1",
> "Primary");
> Console.WriteLine(ao.Name);
> GWSystem.Nicknames.Add("testgall1234",
> ao,ao.PostOffice,ao.Domain);
> }
> catch (Exception ex)
> {
> Console.WriteLine(ex.ToString());
> }
> }
>
>
> When I try to supply strings like so
>
> GWSystem.Nicknames.Add("testgall1234", ao,"PO1","Primary");
>
>
> as documented at
>

http://developer.novell.com/documentation/gwadmin/gwadmenu/data/hr1myg2u.htm

>
> l I receive "An invalid argument was passed in the function call"
>
>
>
>
> On another note, can the Groupwise API Gateway do a bulk-remove of all
> aliases? I really was trying to avoid installing it(I hate the way it
> works
> with its voodoo text file monitor) but we have about 3000 aliases to
> remove.

0 Likes
gallwapa Absent Member.
Absent Member.

Re: Admin Object API - Create Nickname - An unknown error occurred

Of course I spoke to soon, I found the forum, heh!

>>> Preston Stephenson<PStephenson@gw.novell.com> 6/1/2009 4:16 AM >>>

I created a bug to track the problem.
You might try posting something on the gwadmin
forum to see if anyone has seen the problem or
has a work around.

Preston

>>> On Thursday, May 28, 2009 at 9:42 AM, Preston

Gallwas<GallwaPA@puyallup.k12.wa.us> wrote:
> Ignore (file://\fs) - it was an error in converting to plain text from

html
> for posting
>
>>>> Preston Gallwas<GallwaPA@puyallup.k12.wa.us> 5/28/2009 8:27 AM >>>

> Hi all,
>
> We're trying to remove all aliases and create nicknames for them instead.


> I
> realize the alias part can't be done via the Admin Object API

(grrrrr!!!!!)
> but at least the nickname piece can. I can add a new users, however, I

am
> not able to add nicknames. I am receiving "An unknown error occurred".
>
> [STAThread]
> static void Main(string[] args)
> {
> try
> {
> AdminTypeLibrary.System GWSystem = new
> AdminTypeLibrary.System();
> string strPath = @"\\fs\vol1\gw\dom\primary (

file://\fs)";
> GWSystem.Connect(strPath);
> AdminTypeLibrary.AdminObject ao =
> (AdminTypeLibrary.AdminObject)GWSystem.Users.Item("gall", "PO1",
> "Primary");
> Console.WriteLine(ao.Name);
> GWSystem.Nicknames.Add("testgall1234",
> ao,ao.PostOffice,ao.Domain);
> }
> catch (Exception ex)
> {
> Console.WriteLine(ex.ToString());
> }
> }
>
>
> When I try to supply strings like so
>
> GWSystem.Nicknames.Add("testgall1234", ao,"PO1","Primary");
>
>
> as documented at
>

http://developer.novell.com/documentation/gwadmin/gwadmenu/data/hr1myg2u.htm


>
> l I receive "An invalid argument was passed in the function call"
>
>
>
>
> On another note, can the Groupwise API Gateway do a bulk-remove of all
> aliases? I really was trying to avoid installing it(I hate the way it
> works
> with its voodoo text file monitor) but we have about 3000 aliases to
> remove.



0 Likes
gallwapa Absent Member.
Absent Member.

Re: Admin Object API - Create Nickname - An unknown error occurred

FYI I resolved this on my own as mentioned in novell.devsup.gwadmin -- here
is a cross post for completeness
---------------------------------

I got this working... apparently there might be some overrides in a derived
class or something.

We found that ao.Domain.Name as I originally posted was returning a
different domain (the one I was connecting to). When I changed the admin
object to this

po.Users.Item(owner, po, domain);

rather than
GWSystem.Users.Item(owner,po,domain);

It began working.


Here is the working code if anyone needs to use it in the future.

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
namespace GWAdmin
{

class Program
{
[STAThread]
static void Main(string[] args)
{
StringBuilder sbLog = new StringBuilder();
StreamWriter swLog = new
StreamWriter(@"C:\alias-to-nickname.log");
try
{
AdminTypeLibrary.System GWSystem = new
AdminTypeLibrary.System();
string strPath = @"\\fs\vol1\gw\dom\primary (
file://fs/vol1/gw/dom/primary )";
GWSystem.Connect(strPath);
List<string[]> list = parseCSV(@"C:\aliasnohead-test.csv");


foreach (string[] strarr in list)
{

string poName = strarr[3];
string owner = strarr[4];
string nickname = strarr[1];
AdminTypeLibrary.Domain domain =
GWSystem.Domains.Item("primary");
AdminTypeLibrary.PostOffice po =
GWSystem.PostOffices.Item(poName, domain);
AdminTypeLibrary.User3 user3User =
(AdminTypeLibrary.User3)po.Users.Item(owner, po, domain);
if (user3User.PrefEMailID != null)
{
user3User.PrefEMailID = null;
user3User.ClearAddressFormat();
user3User.ClearAllowedAddressFormat();
user3User.ClearInternetDomainName();
user3User.Commit();
sbLog.AppendLine(DateTime.Now + " :: Cleared
PrefEMailID from user: " + user3User.Name);
}
else
{
sbLog.AppendLine(DateTime.Now + " :: PrefEMailID
for : " + user3User.Name + " was blank. Skipping...");
}
AdminTypeLibrary.AdminObject ao =
(AdminTypeLibrary.AdminObject)user3User;
GWSystem.Nicknames.Add(nickname, ao, ao.PostOffice,
ao.PostOffice.Domain);
sbLog.AppendLine(DateTime.Now + " :: Added nickname: "
+ nickname + " for owner: " + owner);
}




}
catch (Exception ex)
{
sbLog.AppendLine(DateTime.Now + " :: " + ex.ToString);
swLog.WriteLine(sbLog.ToString());
}
swLog.WriteLine(sbLog.ToString());
swLog.Close();

}
public static List<string[]> parseCSV(string path)
{
List<string[]> parsedData = new List<string[]>();

try
{
using (StreamReader readFile = new StreamReader(path))
{
string line;
string[] row;

while ((line = readFile.ReadLine()) != null)
{
row = line.Split(',');
parsedData.Add(row);
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}

return parsedData;
}

}
}





>>> Preston Gallwas<GallwaPA@puyallup.k12.wa.us> 5/28/2009 8:27 AM >>>

Hi all,

We're trying to remove all aliases and create nicknames for them instead.
I
realize the alias part can't be done via the Admin Object API (grrrrr!!!!!)
but at least the nickname piece can. I can add a new users, however, I am
not able to add nicknames. I am receiving "An unknown error occurred".

[STAThread]
static void Main(string[] args)
{
try
{
AdminTypeLibrary.System GWSystem = new
AdminTypeLibrary.System();
string strPath = @"\\fs\vol1\gw\dom\primary ( file://\fs)";
GWSystem.Connect(strPath);
AdminTypeLibrary.AdminObject ao =
(AdminTypeLibrary.AdminObject)GWSystem.Users.Item("gall", "PO1",
"Primary");
Console.WriteLine(ao.Name);
GWSystem.Nicknames.Add("testgall1234",
ao,ao.PostOffice,ao.Domain);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}


When I try to supply strings like so

GWSystem.Nicknames.Add("testgall1234", ao,"PO1","Primary");


as documented at
http://developer.novell.com/documentation/gwadmin/gwadmenu/data/hr1myg2u.htm

l I receive "An invalid argument was passed in the function call"




On another note, can the Groupwise API Gateway do a bulk-remove of all
aliases? I really was trying to avoid installing it(I hate the way it
works
with its voodoo text file monitor) but we have about 3000 aliases to
remove.




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.