<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Calin Tatar</title>
        <link>http://geekswithblogs.net/CalinTatar/Default.aspx</link>
        <description> C#.NET, VB.NET, WPF, SILVERLIGHT, SQL, WSS, MOSS</description>
        <language>en-US</language>
        <copyright>CalinTatar</copyright>
        <managingEditor>tatar_calin@yahoo.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Calin Tatar</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/CalinTatar/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Automatically add Sharepoint subfolders when adding a new Folder Content Type</title>
            <category>UI Automation</category>
            <category>MOSS 2007</category>
            <category>WSS 3.0</category>
            <link>http://geekswithblogs.net/CalinTatar/archive/2009/06/07/automatically-add-sharepoint-subfolders-when-adding-a-new-folder-content.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/CalinTatar/archive/2009/06/07/automatically-add-sharepoint-subfolders-when-adding-a-new-folder-content.aspx'&gt;http://geekswithblogs.net/CalinTatar/archive/2009/06/07/automatically-add-sharepoint-subfolders-when-adding-a-new-folder-content.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;Last week I was asked on one of my CodeProject article, about how to implement a Sharepoint feature that will automatically add subfolders to a parent folder in a document library.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;To add subfolders when a new Folder(or derived Content Type from Folder) was created, we have to write a feature, that will handle the &lt;strong&gt;ItemAdded&lt;/strong&gt; event. When this event gets fired, we can get the current folder item and add subfolders to it.&lt;br /&gt;
&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;The following feature adds subfolders( the ones from folders array) when a new Project Folder is created.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;img height="505" alt="SubFoldersCreatorFeature" width="900" src="http://gwb.blob.core.windows.net/calintatar/SubFoldersFeaature/SubFoldersCreatorFeature.png" /&gt;&lt;/p&gt;
&lt;p&gt;Basically, what the above method is doing is:&lt;/p&gt;
&lt;p&gt;- we get the current document library that we are working on.&lt;/p&gt;
&lt;p&gt;- test if the current Item is derived from our Content Type; with this we can restrict the feature to work only on some of the folder content types&lt;/p&gt;
&lt;p&gt;- by getting the url of the current folder, we can add a new folder on the current &lt;strong&gt;SPDocumentLibrary&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Calin Tatar&lt;/strong&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/CalinTatar/aggbug/132664.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CalinTatar</dc:creator>
            <guid>http://geekswithblogs.net/CalinTatar/archive/2009/06/07/automatically-add-sharepoint-subfolders-when-adding-a-new-folder-content.aspx</guid>
            <pubDate>Sun, 07 Jun 2009 03:48:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/CalinTatar/comments/132664.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/CalinTatar/archive/2009/06/07/automatically-add-sharepoint-subfolders-when-adding-a-new-folder-content.aspx#feedback</comments>
            <slash:comments>26</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/CalinTatar/comments/commentRss/132664.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Retrieving the object hierarchy from an XML with Linq to XML</title>
            <category>Linq to XML</category>
            <link>http://geekswithblogs.net/CalinTatar/archive/2009/05/16/retrieving-the-object-hierarchy-from-an-xml-with-linq-to.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/CalinTatar/archive/2009/05/16/retrieving-the-object-hierarchy-from-an-xml-with-linq-to.aspx'&gt;http://geekswithblogs.net/CalinTatar/archive/2009/05/16/retrieving-the-object-hierarchy-from-an-xml-with-linq-to.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;I'm writing here an example about how to read XMLs that contains &lt;font face="Arial"&gt;hierarchichal data, not only with one level of child nodes. So, I'm about to threat this problem here.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;First, I'll define a sample XML hierarchy. The XML contains a list of Headers, each one containing a list of Details.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;img height="416" alt="" width="427" src="http://gwb.blob.core.windows.net/calintatar/Data.jpg" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Now, let's create some simple model classes. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;img height="446" alt="" width="391" src="http://gwb.blob.core.windows.net/calintatar/Header.jpg" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;img height="307" alt="" width="313" src="http://gwb.blob.core.windows.net/calintatar/Detail.jpg" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt; Now, to read the XML data into this hierarchy of objects, I'm gonna create one method for each level of the hierarchy (&lt;strong&gt;GetHeaders - &lt;/strong&gt;will return all the Headers, &lt;strong&gt;GetDetails(header)&lt;/strong&gt; - will return a list of Detail's for one Header. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Basically, a method will return a list of childrens based on the parent node.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;img height="473" alt="" width="607" src="http://gwb.blob.core.windows.net/calintatar/Code(1).jpg" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/CalinTatar/aggbug/132157.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CalinTatar</dc:creator>
            <guid>http://geekswithblogs.net/CalinTatar/archive/2009/05/16/retrieving-the-object-hierarchy-from-an-xml-with-linq-to.aspx</guid>
            <pubDate>Sat, 16 May 2009 06:03:50 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/CalinTatar/comments/132157.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/CalinTatar/archive/2009/05/16/retrieving-the-object-hierarchy-from-an-xml-with-linq-to.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/CalinTatar/comments/commentRss/132157.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Switching from Win32 to UI Automation</title>
            <category>UI Automation</category>
            <category>Win32 Interop</category>
            <link>http://geekswithblogs.net/CalinTatar/archive/2009/05/16/switching-from-win32-to-ui-automation.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/CalinTatar/archive/2009/05/16/switching-from-win32-to-ui-automation.aspx'&gt;http://geekswithblogs.net/CalinTatar/archive/2009/05/16/switching-from-win32-to-ui-automation.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;If you are about to write another p/invoke (Win32 calls) to access existing Windows, Controls,...you should consider switching to UI Automation framework, which provides programmatic access to most user interface (UI) elements on the desktop, by writing managed code.  Some time ago I wrote an article about UI Automation, have a look at:  &lt;font face="Arial"&gt;&lt;a href="http://www.codeproject.com/KB/WPF/WPF_UI_Automation.aspx"&gt;http://www.codeproject.com/KB/WPF/WPF_UI_Automation.aspx&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;In this post, I'll try to compare two ways of implementing Windows automation applications, by using unmanaged code (Win32 interoperability) and by using the UI Automation framework (managed code).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;OK, let's take a simple example. Suppose we want to write a piece of code that gets the active window and some details about this window.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Instead of writing Win32 calls for &lt;strong&gt;GetWindow&lt;/strong&gt;, &lt;font face="Arial"&gt;&lt;strong&gt;GetWindowRect&lt;/strong&gt;, different structures, etc, with UI Automation we can write simple managed code to accomplish the same task.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Basically, we just need to get &lt;strong&gt;AutomationElement.FocusedElement&lt;/strong&gt; and this will provide us useful informations about the focused control which might be a simple control(Button, TextBox, etc) or a Window. Let's assume that the returned FocusedControl is a Textbox, a not a Window; we still can get the parent Window of that control, by getting first the ProcessId property. Based on the process Id, we can create an instance of Process class and access &lt;strong&gt;process.MainWindowHandle&lt;/strong&gt;, to get the Window handle. Now, based on the Window handle, we can call the static method AutomationElement.FromHandle() and you'll get the AutomationElement for the window. To get the window bounds, just call &lt;strong&gt;windowElement.Current.BoundingRectangle&lt;/strong&gt; and you'll obtain a &lt;strong&gt;Rect&lt;/strong&gt; object. After that you may use the bounds to capture the window, etc.&lt;/font&gt;&lt;/p&gt;
&lt;font size="2"&gt;&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;AutomationElement&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; controlElement = &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;AutomationElement&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.FocusedElement;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (controlElement != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp;&amp;amp; controlElement.Current.ControlType != &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;ControlType&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Window)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Process&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; process = &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Process&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.GetProcessById(controlElement.Current.ProcessId);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;AutomationElement&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; windowElement = &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;AutomationElement&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.FromHandle(process.MainWindowHandle);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (windowElement != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Rect&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; r = windowElement.Current.BoundingRectangle;&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;/blockquote&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Another example would be to get the user control based on the cursor position. So we want to find a managed solution for &lt;strong&gt;WindowFromPoint &lt;/strong&gt;Win32 function. We can accomplish this without writing Interop code, by calling and passing a Point to &lt;strong&gt;AutomationElement.FromPoint();&lt;/strong&gt;  &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/font&gt; &lt;img src="http://geekswithblogs.net/CalinTatar/aggbug/132151.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CalinTatar</dc:creator>
            <guid>http://geekswithblogs.net/CalinTatar/archive/2009/05/16/switching-from-win32-to-ui-automation.aspx</guid>
            <pubDate>Sat, 16 May 2009 01:40:03 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/CalinTatar/comments/132151.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/CalinTatar/archive/2009/05/16/switching-from-win32-to-ui-automation.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/CalinTatar/comments/commentRss/132151.aspx</wfw:commentRss>
        </item>
        <item>
            <title>SharePoint Workflows for Folder Content Type</title>
            <category>Sharepoint</category>
            <link>http://geekswithblogs.net/CalinTatar/archive/2009/02/27/sharepoint-workflows-for-folder-content-type.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/CalinTatar/archive/2009/02/27/sharepoint-workflows-for-folder-content-type.aspx'&gt;http://geekswithblogs.net/CalinTatar/archive/2009/02/27/sharepoint-workflows-for-folder-content-type.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I plan to announce all my future &lt;a href="http://www.codeproject.com/"&gt;Code Project&lt;/a&gt; articles. &lt;/p&gt;
&lt;p&gt;So, I'm starting here by announcing an older article of mine.&lt;/p&gt;
&lt;p&gt;The article shows how to implement a workaround to start a Sharepoint Workflow from a custom Folder Content Type. &lt;/p&gt;
&lt;p&gt;Enjoy! &lt;a target="_blank" href="http://www.codeproject.com/KB/sharepoint/MOSS_FolderContentTypeWF.aspx"&gt;SharePoint Workflows for Folder Content Type &lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Calin Tatar&lt;/strong&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/CalinTatar/aggbug/129727.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CalinTatar</dc:creator>
            <guid>http://geekswithblogs.net/CalinTatar/archive/2009/02/27/sharepoint-workflows-for-folder-content-type.aspx</guid>
            <pubDate>Fri, 27 Feb 2009 08:11:31 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/CalinTatar/comments/129727.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/CalinTatar/archive/2009/02/27/sharepoint-workflows-for-folder-content-type.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/CalinTatar/comments/commentRss/129727.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Hello World</title>
            <link>http://geekswithblogs.net/CalinTatar/archive/2009/02/27/hello-world.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/CalinTatar/archive/2009/02/27/hello-world.aspx'&gt;http://geekswithblogs.net/CalinTatar/archive/2009/02/27/hello-world.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Welcome to my new blog!&lt;/p&gt;
&lt;p&gt;I will post here my thoughts/samples/code snippets related to Microsoft technologies.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Calin Tatar&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/CalinTatar/aggbug/129726.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CalinTatar</dc:creator>
            <guid>http://geekswithblogs.net/CalinTatar/archive/2009/02/27/hello-world.aspx</guid>
            <pubDate>Fri, 27 Feb 2009 07:59:15 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/CalinTatar/comments/129726.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/CalinTatar/archive/2009/02/27/hello-world.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/CalinTatar/comments/commentRss/129726.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>