{"id":571,"date":"2009-12-29T06:03:00","date_gmt":"2009-12-29T06:03:00","guid":{"rendered":"http:\/\/atumvirtwordpress.azurewebsites.net\/?p=571"},"modified":"2009-12-29T06:03:00","modified_gmt":"2009-12-29T06:03:00","slug":"sample-application-using-groupwise-administrative-object-api","status":"publish","type":"post","link":"https:\/\/avtempwp.azurewebsites.net\/2009\/12\/sample-application-using-groupwise-administrative-object-api\/","title":{"rendered":"Sample Application using Groupwise Administrative Object API"},"content":{"rendered":"

Below is a copy of the source to a C# App that connects to a domain and creates a nickname for every user in the CSV. This code can be easily modified (and was in our case) to set the LDAP Authentication field in Groupwise to enable authentication via services such as Active Directory.<\/p>\n

\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Runtime.InteropServices;\nusing System.IO;\nnamespace GWAdmin {\n\n class Program {\n  [STAThread]\n  static void Main(string[] args) {\n   StringBuilder sbLog = new StringBuilder();\n   StreamWriter swLog = new StreamWriter(@ \"C:alias-to-nickname.log\");\n   try {\n    AdminTypeLibrary.System GWSystem = new AdminTypeLibrary.System();\n    string strPath = @ \"\\fsvol1gwdomprimary\";\n    GWSystem.Connect(strPath);\n    List list = parseCSV(@ \"C:aliasnohead-test.csv\");\n\n    foreach(string[] strarr in list) {\n\n     string poName = strarr[3];\n     string owner = strarr[4];\n     string nickname = strarr[1];\n     AdminTypeLibrary.Domain domain = GWSystem.Domains.Item(\"primary\");\n     AdminTypeLibrary.PostOffice po = GWSystem.PostOffices.Item(poName, domain);\n     AdminTypeLibrary.User3 user3User = (AdminTypeLibrary.User3) po.Users.Item(owner, po, domain);\n     if (user3User.PrefEMailID != null) {\n      user3User.PrefEMailID = null;\n      user3User.ClearAddressFormat();\n      user3User.ClearAllowedAddressFormat();\n      user3User.ClearInternetDomainName();\n      user3User.Commit();\n      sbLog.AppendLine(DateTime.Now + \" :: Cleared PrefEMailID from user: \" + user3User.Name);\n     } else {\n      sbLog.AppendLine(DateTime.Now + \" :: PrefEMailID for : \" + user3User.Name + \" was blank. Skipping...\");\n     }\n     AdminTypeLibrary.AdminObject ao = (AdminTypeLibrary.AdminObject) user3User;\n     GWSystem.Nicknames.Add(nickname, ao, ao.PostOffice, ao.PostOffice.Domain);\n     sbLog.AppendLine(DateTime.Now + \" :: Added nickname: \" + nickname + \" for owner: \" + owner);\n    }\n\n   } catch (Exception ex) {\n    sbLog.AppendLine(DateTime.Now + \" :: \" + ex.ToString);\n    swLog.WriteLine(sbLog.ToString());\n   }\n   swLog.WriteLine(sbLog.ToString());\n   swLog.Close();\n\n  }\n  public static List parseCSV(string path) {\n   List parsedData = new List();\n\n   try {\n    using(StreamReader readFile = new StreamReader(path)) {\n     string line;\n     string[] row;\n\n     while ((line = readFile.ReadLine()) != null) {\n      row = line.Split(',');\n      parsedData.Add(row);\n     }\n    }\n   } catch (Exception e) {\n    Console.WriteLine(e.Message);\n   }\n\n   return parsedData;\n  }\n\n }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"

Below is a copy of the source to a C# App that connects to a domain and creates a nickname for every user in the CSV. This code can be easily modified (and was in our case) to set the LDAP Authentication field in Groupwise to enable authentication via services such as Active Directory. using […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,6,15,23,29,50],"tags":[],"_links":{"self":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/posts\/571"}],"collection":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/comments?post=571"}],"version-history":[{"count":0,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/posts\/571\/revisions"}],"wp:attachment":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/media?parent=571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/categories?post=571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/tags?post=571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}