Jan
24
2010

Ruby on Rails and Sharepoint Integration

After a long period (around 2 to 3 years), Again i got a chance to work on “Ruby On Rails” . Here’s my first test program on “Ruby On Rails” using “Iron Ruby” to integrate with sharepoint.

I am using the “SciTE” editor for “Ruby On Rails” programming.  For Iron Ruby we need to configure the “SciTE” editor.

Step 1: Launch the “SciTE” editor

Step 2: Choose “Options > Open ruby.properties” file

Step 3: Use “Ctrl+G” and goto line “108″

Step 4: command the existing line and modify the line (108) as below

rubyproperties

Step 5: Save the file.

Step 6: Create a file “hello.rb” and type the below lines


require 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL'
require 'Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL'
Uri = System::Uri
SPWebApplication = Microsoft::SharePoint::Administration::SPWebApplication
mywebapp = SPWebApplication.Lookup(Uri.new("http://nintex"))
mywebapp.Sites.each do |site|
puts site.Url
end

Step 7: Save the and “Click” F5 to execute the code.

Step 8: Here’s the results (the above code print all the site urls)

results


Get Adobe Flash playerPlugin by wpburn.com wordpress themes
 
All rights reserved by SharePointInsights.com. For advertisement details, contact us: advertise@SharePointInsights.com. Theme by openark.org