{"id":1117,"date":"2014-03-11T10:25:34","date_gmt":"2014-03-11T09:25:34","guid":{"rendered":"http:\/\/www.capri-soft.de\/blog\/?p=1117"},"modified":"2014-03-11T10:49:12","modified_gmt":"2014-03-11T09:49:12","slug":"cldap-email-an-lotus-notes-gruppen-per-smtp-schicken","status":"publish","type":"post","link":"https:\/\/www.capri-soft.de\/blog\/?p=1117","title":{"rendered":"C#+LDAP: Email an Lotus Notes Gruppen per SMTP schicken"},"content":{"rendered":"<h1>Problem<\/h1>\n<p>In einem Unternehmen sollen Lotus Notes Gruppen aufgel\u00f6st werden um den Mitgliedern der LN Gruppe Mails \u00fcber einen normalen SMTP Server zu schicken<\/p>\n<h1>Ansatz<\/h1>\n<p>Lotus Notes besitzt i.d.R. einen LDAP Server, der die Notes Gruppen aufschl\u00fcsselt. Auf LDAP kann \u00fcber C# zugegriffen werden.<\/p>\n<h1>L\u00f6sung<\/h1>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\npublic ArrayList resolvingNotesGroups(String mailGroup)\r\n{\r\n ArrayList alMailAddys = new ArrayList();\r\n\r\n DirectoryEntry DirEntry = new DirectoryEntry();\r\n {\r\n  DirEntry.Path = &quot;LDAP:\/\/notesldap.it.company.com&quot;;\r\n  DirEntry.AuthenticationType = AuthenticationTypes.ServerBind;\r\n }\r\n   \r\n DirectorySearcher search = new DirectorySearcher(DirEntry);\r\n DirectoryEntry de = new DirectoryEntry();\r\n\r\n Dictionary&lt;String, String&gt; dict = new Dictionary&lt;string, string&gt;();\r\n\r\n \/\/ Tweak this to refine your search\r\n search.Filter = &quot;(cn=&quot; + mailGroup + &quot;)&quot;;\/\/ BBME_AC_Rubi\r\n \/\/ I limit my results while I tweak          \r\n search.SearchScope = SearchScope.Subtree;          \r\n\r\n try\r\n {\r\n  SearchResultCollection src = search.FindAll();\r\n        \r\n  if (src.Count != 0)\r\n  {\r\n   foreach (SearchResult result in search.FindAll())\r\n   {\r\n    \/\/ Display each of the values for the property \r\n    \/\/ identified by the property name.\r\n    foreach (object property in result.Properties&#x5B;&quot;member&quot;])\r\n    {\r\n     \/\/ CN Name ermitteln\r\n     dict.Add(property.ToString(), &quot;&quot;);\r\n    }\r\n   }\r\n    \r\n  }\r\n  else\r\n  {\r\n   throw new Exception(&quot;GroupResolving - No Entry found for: &quot; + search.Filter);\r\n  }\r\n\r\n  int indexStart;\r\n  int indexEnd;\r\n\r\n\r\n  foreach (KeyValuePair&lt;string, string&gt; entry in dict)\r\n  {\r\n   search.Dispose();\r\n   search = new DirectorySearcher(DirEntry);\r\n\r\n   indexStart = entry.Key.IndexOf(&quot;=&quot;);\r\n   indexEnd = entry.Key.IndexOf(&quot;,&quot;);\r\n\r\n   \/\/ Entry key only CN \r\n   search.Filter = &quot;(cn=&quot; + entry.Key.Substring(indexStart + 1, indexEnd - indexStart - 1) + &quot;)&quot;;\r\n   search.SearchScope = SearchScope.Subtree;\r\n\r\n   foreach (SearchResult result in search.FindAll())\r\n   {\r\n    if (result != null)\r\n    {\r\n\r\n     de = result.GetDirectoryEntry();\r\n     alMailAddys.Add(de.Properties&#x5B;&quot;mail&quot;].Value.ToString());\r\n    }\r\n    else\r\n    {\r\n     throw new Exception(&quot;Peolple Resolving - No Entry found for: &quot; + search.Filter);\r\n    }\r\n   }\r\n  }\r\n\r\n }\r\n catch (Exception ex)\r\n {\r\n  throw new Exception(&quot;Following error occured: &quot; + ex.Message.ToString());\r\n }\r\n finally\r\n {\r\n  search.Dispose();\r\n  DirEntry.Close();\r\n }\r\n\r\n return alMailAddys;\r\n}}<\/pre>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Fwww.capri-soft.de%2Fblog%2F%3Fp%3D1117&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px;margin-top:5px;\"><\/iframe>","protected":false},"excerpt":{"rendered":"<p>Problem In einem Unternehmen sollen Lotus Notes Gruppen aufgel\u00f6st werden um den Mitgliedern der LN Gruppe Mails \u00fcber einen normalen SMTP Server zu schicken Ansatz Lotus Notes besitzt i.d.R. einen LDAP Server, der die Notes Gruppen aufschl\u00fcsselt. Auf LDAP kann \u00fcber C# zugegriffen werden. L\u00f6sung public ArrayList resolvingNotesGroups(String mailGroup) { ArrayList alMailAddys = new ArrayList(); &hellip; <a href=\"https:\/\/www.capri-soft.de\/blog\/?p=1117\" class=\"more-link\"><span class=\"screen-reader-text\">C#+LDAP: Email an Lotus Notes Gruppen per SMTP schicken<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[],"class_list":["post-1117","post","type-post","status-publish","format-standard","hentry","category-net"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4yGeN-i1","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1117"}],"version-history":[{"count":4,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1117\/revisions"}],"predecessor-version":[{"id":1120,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1117\/revisions\/1120"}],"wp:attachment":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}