{"id":4186,"date":"2013-09-01T20:11:25","date_gmt":"2013-09-01T18:11:25","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=4186"},"modified":"2014-04-15T14:58:12","modified_gmt":"2014-04-15T12:58:12","slug":"copy-to-public-folder-there-is-no-replica-for-that-mailbox-on-this-server","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/copy-to-public-folder-there-is-no-replica-for-that-mailbox-on-this-server","title":{"rendered":"Copy to public folder: &#8220;There is no replica for that mailbox on this server.&#8221;"},"content":{"rendered":"<p>When copying an mail from the personal folder to a Public folder, you may receive &#8220;There is no replica for that mailbox on this server.&#8221; error.<\/p>\n<p>This error is generated by Exchange server and unfortunately this is the Exchange limitation. Here&#8217;s Microsoft&#8217;s response to this problem:<\/p>\n<blockquote><p>\nCopying from user mailboxes to public folders does not work with Exchange IMAP4.<br \/>\nYour users need to copy the message to a personal folder and then back up to the public folder (append) or forward it to an address that gets archived to a public folder.\n<\/p><\/blockquote>\n<h2>Workaround<\/h2>\n<p>It seems the only way to workaround this is by downloading a message and uploading it to public folder. Important thing is that you don&#8217;t need to parse email message at all &#8211; you just download and upload raw eml data. Please also note that public folder may be in fact stored on a another IMAP server instance (different server address) &#8211; this is usually indicated during logon with REFERRAL error.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nusing(Imap imap = new Imap())\r\n{\r\n    imap.Connect(&quot;imap.example.com&quot;);   \/\/ or ConnectSSL for SSL\r\n    imap.UseBestLogin(&quot;user&quot;, &quot;password&quot;);\r\n\r\n    imap.SelectInbox();\r\n    List&lt;long&gt; uids = imap.Search(Flag.All);\r\n\r\n    foreach (long uid in uids)\r\n    {\r\n        var eml = imap.GetMessageByUID(uid);\r\n        IMail email = new MailBuilder().CreateFromEml(eml);\r\n\r\n        if (email.Subject.Contains(&quot;&#x5B;REF&quot;))\r\n            UploadToPublic(email);\r\n    }\r\n    imap.Close();\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nUsing imap As New Imap()\r\n\timap.Connect(&quot;imap.example.com&quot;)\t' or ConnectSSL for SSL\r\n\timap.UseBestLogin(&quot;user&quot;, &quot;password&quot;)\r\n\r\n\timap.SelectInbox()\r\n\tDim uids As List(Of Long) = imap.Search(Flag.All)\r\n\r\n\tFor Each uid As Long In uids\r\n\t\tDim eml = imap.GetMessageByUID(uid)\r\n\t\tDim email As IMail = New MailBuilder().CreateFromEml(eml)\r\n\r\n\t\tIf email.Subject.Contains(&quot;&#x5B;REF&quot;) Then\r\n\t\t\tUploadToPublic(email)\r\n\t\tEnd If\r\n\tNext\r\n\timap.Close()\r\nEnd Using\r\n<\/pre>\n<p>Here is the body of <em>UploadToPublic <\/em>method:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C# code\r\n\r\nprivate void UploadToPublic(IMail email)\r\n{\r\n    using (Imap imap = new Imap())\r\n    {\r\n        imap.Connect(&quot;server&quot;);  \/\/ or ConnectSSL for SSL\r\n        imap.Login(&quot;user&quot;, &quot;password&quot;);\r\n    \r\n        imap.UploadMessage(&quot;#Public\/Cases&quot;, email);\r\n    \r\n        imap.Close();\r\n    }\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET code\r\n\r\nPrivate Sub UploadToPublic(email As IMail)\r\n\tUsing imap As New Imap()\r\n\t\timap.Connect(&quot;server&quot;)\r\n\t\t' or ConnectSSL for SSL\r\n\t\timap.Login(&quot;user&quot;, &quot;password&quot;)\r\n\r\n\t\timap.UploadMessage(&quot;#Public\/Cases&quot;, email)\r\n\r\n\t\timap.Close()\r\n\tEnd Using\r\nEnd Sub\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When copying an mail from the personal folder to a Public folder, you may receive &#8220;There is no replica for that mailbox on this server.&#8221; error. This error is generated by Exchange server and unfortunately this is the Exchange limitation. Here&#8217;s Microsoft&#8217;s response to this problem: Copying from user mailboxes to public folders does not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[21,28,77],"class_list":["post-4186","post","type-post","status-publish","format-standard","hentry","category-mail-dll","category-programming","tag-exchange","tag-imap","tag-imap-component"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4186"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=4186"}],"version-history":[{"count":15,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4186\/revisions"}],"predecessor-version":[{"id":4558,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4186\/revisions\/4558"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=4186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=4186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=4186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}