{"id":578,"date":"2005-04-21T21:01:02","date_gmt":"2005-04-21T19:01:02","guid":{"rendered":"http:\/\/10.0.0.2\/wordpress\/?p=578"},"modified":"2005-04-21T21:01:02","modified_gmt":"2005-04-21T19:01:02","slug":"c_code_snippets","status":"publish","type":"post","link":"https:\/\/www.switchbl8.nl\/blog\/2005\/04\/c_code_snippets\/","title":{"rendered":"C# code snippets"},"content":{"rendered":"<p>Perhaps this category will have obvious solutions or tips, but I&#8217;ll share them anyway: C# code snippets. This first one is about logging on to Outlook, which I needed for E-Sync. All samples give you the code with the name of the profile to logon to, or &#8220;leave the values for profile and password blank to use the default profile&#8221;. The first one means hard-coding a profile, the second one I did not get working on 2 different machines, so I guess it used to be like that but not anymore.<\/p>\n<p>Here&#8217;s how to lookup the default profile in the registry, and logon to the MAPI-store.<\/p>\n<pre lang=\"CSharp\">\nRegistryKey myKey = Registry.CurrentUser;\nmyKey = myKey.OpenSubKey(\"SoftwareMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfiles\");\nString myProfile = myKey.GetValue(\"DefaultProfile\").ToString();\nmyMAPISession.Logon(myProfile,\"\",true,myMV,myMV,myMV,myMV);\n<\/pre>\n<p>Don&#8217;t forget to include &#8220;using Microsoft.Win32;&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Perhaps this category will have obvious solutions or tips, but I&#8217;ll share them anyway: C# code snippets. This first one is about logging on to Outlook, which I needed for E-Sync. All samples give you the code with the name of the profile to logon to, or &#8220;leave the values for profile and password blank <a href='https:\/\/www.switchbl8.nl\/blog\/2005\/04\/c_code_snippets\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,40,10],"tags":[],"class_list":["post-578","post","type-post","status-publish","format-standard","hentry","category-c","category-code-snippets","category-e-sync","category-39-id","category-40-id","category-10-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/comments?post=578"}],"version-history":[{"count":0,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/578\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/media?parent=578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/categories?post=578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/tags?post=578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}