<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>Iron Python and Sharepoint</title>
        <link>http://geekswithblogs.net/paullee/category/9975.aspx</link>
        <description>Iron Python and Sharepoint</description>
        <language>en-US</language>
        <copyright>Paul Lee</copyright>
        <managingEditor>plee.paul@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Make a subfolder hierarchy inherit from parent</title>
            <link>http://geekswithblogs.net/paullee/archive/2009/05/01/making-a-subfolder-hierarchy-inherit-from-parent.aspx</link>
            <description>&lt;span lang="EN"&gt;
&lt;p&gt;&lt;font size="2"&gt;I have been involved in a huge public folder migration project for my company. One particular folder I migrated had a hierarchy of 1500 subfolders. The migration tool was nice enough to migrate the permissions for me for each folder into sharepoint. Cool, right? Yes until my manager told me he just wanted to manage the parent folder in sharepoint and have the subfolders inherit everything.  There is nothing in sharepoint out-of-the-box that lets you do this in one shot.  Now there are probably many 3rd party sharepoint admin tools that will do this.  But here is the poor man's way.  Simple IronPython script.&lt;/font&gt;&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;import clr&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;clr.AddReference("Microsoft.SharePoint")&lt;br /&gt;
from Microsoft.SharePoint import SPSite&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;siteurl = '&amp;lt;url to site&amp;gt;'&lt;br /&gt;
url= '&amp;lt;url to doclib&amp;gt;'&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;site = SPSite(siteurl)&lt;br /&gt;
web = site.OpenWeb()&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;docLib = web.GetList(url)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;myfolders = docLib.Folders&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;for furl in myfolders:&lt;br /&gt;
    furl.ResetRoleInheritance()&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p dir="ltr"&gt;&lt;font face="Courier New" size="2"&gt;&lt;font face="Arial"&gt;That's it!  Took me only 10 minutes to write...without knowing much about the sharepoint API.  &lt;font size="2"&gt;The first 3 lines is the key here that lets you hook into the .NET framework and the sharepoint API.  &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr"&gt;&lt;font face="Courier New" size="2"&gt;&lt;font face="Arial"&gt;Please read my original &lt;a href="http://geekswithblogs.net/paullee/archive/2009/04/29/ironpython---sharepoint-programming-for-the-rest-of-us.aspx"&gt;post&lt;/a&gt; for a guide on installing (if you can call it that) IronPython.  &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr"&gt;&lt;font face="Arial"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms550992.aspx"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr"&gt; &lt;/p&gt;
&lt;/span&gt; &lt;img src="http://geekswithblogs.net/paullee/aggbug/131660.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Paul Lee</dc:creator>
            <guid>http://geekswithblogs.net/paullee/archive/2009/05/01/making-a-subfolder-hierarchy-inherit-from-parent.aspx</guid>
            <pubDate>Fri, 01 May 2009 19:02:29 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/paullee/comments/131660.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/paullee/archive/2009/05/01/making-a-subfolder-hierarchy-inherit-from-parent.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/paullee/comments/commentRss/131660.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/paullee/services/trackbacks/131660.aspx</trackback:ping>
        </item>
        <item>
            <title>IronPython - Sharepoint programming for the rest of us</title>
            <link>http://geekswithblogs.net/paullee/archive/2009/04/29/ironpython---sharepoint-programming-for-the-rest-of-us.aspx</link>
            <description>&lt;font size="2"&gt;
&lt;p&gt;For those of us who want to start programming sharepoint but get intimidated by the extensive setup needed to begin with C# and visual studio, IronPython is for you.  Frankly, I have been too lazy to take on the task of installing and configuring visual studio on a VM with MOSS. &lt;/p&gt;
&lt;p&gt;My background(many moons ago) is java development. I'm not a python expert. Nor am I a sharepoint programming expert. I may not even be considered a java expert anymore. And I'm definitely not a C# or .NET guy. I'm writing about iron python because it has been so easy for me to bang out useful scripts without having to get into the complexities(at least for me) of Visual Studio and .NET. &lt;/p&gt;
&lt;p&gt;For the C# or python developers, you will probably laugh at the code I will be posting. My intention here is to show how easy it is write a script to do something useful.  Hopefully my code will get better as I learn more.  &lt;/p&gt;
&lt;p&gt;Also, just to be clear, you will not be creating huge sharepoint programs or features with iron python. To do that, you will still need visual studio and C#. &lt;/p&gt;
&lt;p&gt;So what is IronPython good for? I have been able to create scripts that do basic administrative tasks that sharepoint doesn't provide out-of-the-box.  I know there are many other vendor tools out there that fill in these administrative gaps of sharepoint but my company is not spending any money these days.  &lt;/p&gt;
&lt;p&gt;Here's how to get started:&lt;/p&gt;
&lt;p&gt;- download &lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=12481"&gt;IronPython&lt;/a&gt; on your MOSS (dev or uat) server- The zipped version will do.  I think if you use 2.0 and up, you will need the latest version of .NET which is not required for MOSS.  I am using 1.1.2 because of this.  Yes, I'm lazy...&lt;/p&gt;
&lt;p&gt;- Just unzip the folder somewhere and you're done.  You can test it by double clicking ipy.exe.  &lt;/p&gt;
&lt;p&gt;Type:&lt;/p&gt;
&lt;p&gt;    &lt;strong&gt;print "Hello World"&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;That's it!  You've just installed and written the defacto Hello world program.  Easy right?  It gets better.  I'll begin posting all the scripts I've written using the sharepoint API and explaining how easy it was to write it.  Stay tuned...&lt;/p&gt;
&lt;p&gt;For those of you that want to get more technical with IronPython or just Python, here are some links:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.python.org"&gt;www.python.org&lt;/a&gt; - Official Python site.  &lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;a href="http://ironpython.codeplex.com/"&gt;http://ironpython.codeplex.com/&lt;/a&gt; - Official IronPython site.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;a href="http://www.diveintopython.org/"&gt;http://www.diveintopython.org/&lt;/a&gt; - Good free Python book.  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;Be sure to have the API's handy.&lt;br /&gt;
WSS - &lt;a href="http://msdn.microsoft.com/en-us/library/ms441339.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms441339.aspx&lt;/a&gt;&lt;/font&gt;&lt;font face="Arial"&gt;&lt;br /&gt;
MOSS - &lt;a href="http://msdn.microsoft.com/en-us/library/ms550992.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms550992.aspx&lt;/a&gt;&lt;/font&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/paullee/aggbug/131602.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Paul Lee</dc:creator>
            <guid>http://geekswithblogs.net/paullee/archive/2009/04/29/ironpython---sharepoint-programming-for-the-rest-of-us.aspx</guid>
            <pubDate>Thu, 30 Apr 2009 02:35:55 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/paullee/comments/131602.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/paullee/archive/2009/04/29/ironpython---sharepoint-programming-for-the-rest-of-us.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/paullee/comments/commentRss/131602.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/paullee/services/trackbacks/131602.aspx</trackback:ping>
        </item>
    </channel>
</rss>
