{"id":111245,"date":"2025-06-04T07:00:00","date_gmt":"2025-06-04T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=111245"},"modified":"2025-06-04T08:51:28","modified_gmt":"2025-06-04T15:51:28","slug":"20250604-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20250604-00\/?p=111245","title":{"rendered":"How can I programmatically find the network path by which a folder has been shared?"},"content":{"rendered":"<p>When you right-click a folder in Explorer, select Properties, and go to the Sharing tab, there is a section titled &#8220;Network File and Folder Sharing&#8221;, and in there, it tells you the network path by which this folder has been shared. (Or &#8220;Not shared&#8221; if it hasn&#8217;t been shared at all.) How can I obtain this path programmatically?<\/p>\n<p>There is no one-stop-shop function for doing this. The property sheet calculates it on the fly.<\/p>\n<p>What you can do is call <code>NetShareEnum<\/code> to enumerate all the shared folders (looks like level 2 gives you paths), and then look for one that is equal to or is a parent of the folder in question.<\/p>\n<p>Note that there may be multiple matches. The &#8220;Network File and Folder Sharing&#8221; page shows what it thinks is the best match.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is no direct query. You&#8217;ll have to infer it.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-111245","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>There is no direct query. You&#8217;ll have to infer it.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/111245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=111245"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/111245\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=111245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=111245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=111245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}