Thursday, April 28, 2011

Create a new SharePoint column in User Profile's list














How to get a hidden Sharepoint List for User Profile?
Here is the way to find out hidden user profile's list in sharepoint: At the top level site in site collection, type this url: /_catalogs/users/simple.aspx , that will give you User Information List's default view.


Go and edit this page(site action >> edit page), and than modifiy Shared webpart. It will give list view of this list, edit the current view. Edit will show the editable view of that user Profile's hidden list.


Now you got the place where you can see all the column from this hidden treasure, now it is the time to add a new column in this list, so you can use this column in your custom permission's code:


Here is the PowerShell to Create a New Coloumn in hidden site collection level's "User Information List"




[system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
$site= New-Object Microsoft.SharePoint.SPSite ("http://YourSiteName")
$web=$site.OpenWeb()
$list=$web.Lists["User Information List"]
$list.Fields.Add("Region1", "Text", 0)

Tuesday, April 19, 2011

WebMatrix - New Buzzword in IT Industry

WebMatrix is a free tool that allows you to create, customize and publish websites, Believe me It’s amazingly easy to use.
WebMatrix connects you to a world of popular and free open-source Web applications, including WordPress, DotNetNuke, Umbraco, Joomla!, Moodle, Drupal , and many more(till now 49 apps). You can select a website from built-in gallery, and WebMatrix will handle all the downloading and installation of your new Web site.

Here is the list of Features of WebMatrix which makes it very powerful and #1 development tool for the web development.
Features List of WebMatrix




  • Small, but complete package - It is free web development tool. It is small in size but very powerful tool.


  • Desktop based Web Development and Testing Environment - You will get the same powerful Web server(IIS Express), database engine(SQL CE4), and frameworks(MVC 3.0) that your Web site on the internet uses. This ensures that your transition from development to production is smooth and seamless.


  • Easy to Code - Start with HTML, CSS and JavaScript and then seamlessly connect to a database or add in dynamic server code using the new ‘Razor’ syntax for ASP.NET Web pages.


  • Webmatrix have intellisense - it also supports tag completion and hinting for standard HTML and CSS markup making it easier and faster for you to write code.


  • Simple Publishing - You can find host company to suite your need. Use webMatrix to find your web host which supports webmatrix.


  • Easy to cross bowser testing - You can test your site directly will diffrent browsers using webmartix tool.


  • Last but not least - It will connect you with lots of open source web applications(till the date i am writing this blog - 49 applications incliding most populars WordPress, DotNetNuke, Umbraco, Joomla!, Moodle, Drupal and more)


  • Make your site More Search engine friendly - Run an SEO report and find how to make your site more visible to search engines.


  • Code Helper is the best helping tool - Want to display a Twitter feed? Need to show a video? Code helpers make common tasks easy to do with just a simple tag in your HTML(Yes it is HTML not server side...).


  • Nice Interface with IDE, Database, IIS, FTP, and more - WebMatrix has rich code editor, a database editor, Web server management, Search Engine Optimization, FTP publishing, and many more..


  • Easy and Lightweight Database - Using a database has never been easier! WebMatrix includes a small, embedded database SQL Server CE 4. Copy that database from your machine to web server under bin folder and you are done.

  • Enjoy your Green coding @ code4Green.com

Thursday, April 14, 2011

Compare powershell and STSAdm commands for SharePoint


Here is the Most important STSAdm commands which is used in Sharepoint 2007 for scripting. I have converted those comands into PowerShell, so you can compare and use it. Here is the sample to compare side by side STSAdm and PowerShell commands for Sharepoint:

    STSAdm Command
  • stsadm –o addsolution –filename “D:\Temp\YourSharePointSolution.wsp“

  • stsadm –o deploysolution –name YourSharePointSolution.wsp –url http://myspwebappp –allowgacdeployment –immediate

  • stsadm –o upgradesolution –name YourSharePointSolution.wsp –filename “D:\Temp\YourSharePointSolution.wsp” -immediate

  • stsadm –o retractsolution –name YourSharePointSolution.wsp –url http://myspwebapp –immediate

  • stsadm –o deletesolution –name YourSharePointSolution.wsp

  • stsadm –o activatefeature –name YourFeatureName –url http://YourSharePointWebApp

  • stsadm –o deactivatefeature –name YourFeatureName –url http://YourSharePointWebApp

  • stsadm -o execadmsvcjobs

  • stsadm -o userrole -userlogin "YourUserOrGroupName" -role "Approve" -add -url "http:/YourSPSite"


    PowerShell Command
  • Add-SPSolution “D:\Temp\YourSharePointSolution.wsp“

  • Install-SPSolution –Identity YourSharePointSolution.wsp –WebApplication http://myspwebapp –GACDeployment

  • Update-SPSolution –Identity YourSharePointSolution.wsp –LiteralPath “D:\Temp\YourSharePointSolution.wsp” –GacDeployment

  • Uninstall-SPSolution –Identity YourSharePointSolution.wsp –WebApplication http://myspwebapp

  • Remove-SPSolution–Identity YourSharePointSolution.wsp

  • Enable-SPFeature –Identity YourFeatureNameOrGuid –url http://YourSharePointWebApp

  • Disable-SPFeature –Identity YourFeatureNameOrGuid –url http://YourSharePointWebApp

  • Start-SPAdminJob -Verbose

  • New-SPUser – UserAlias ‘YourUserOrGroupName’–displayname ‘Your Display Name’ –web YourSPSite


Here is the complete list of stsadm command and their related PowerShell command: Click HERE

Thursday, March 31, 2011

Sharepoint Code Generation Tool

Code4Green.com has launched its Sharepoint Code Generation Tool Yesterday. Now Sharepoint developers can create Feature , Fields, Content Types, and Document Library using this tool. Visual Webparts is already available in code4green under ASP.net Category - It generates ascx control and ascx.cs file for given fields. You can Generate Sharepoint Features(i.e. List, Fields, Content Type, Doc. Library) using Code4green's Sharepoint Code Generation Tool. Please give you feedback and if you need any specific feature in sharepoint code generation, please feel to write me on Info@Code4green.com Enjoy Green Coding.... :)

Thursday, March 17, 2011

Copy and Paste of Script from Web page is becoming single line text

Hi,
I have been asked so many times with the development groups that they can not copy and paste the syntax code from some web pages with indentation.
Issue If a Syntax is in HTML's Code element, than simple copy and paste will paste as a single line text (in notepad or Visual Studio IDE). So, It will remove all the indentation also.
Solution: Copy the code from web page and paste into Excel sheet. It will keep indentation and color coding for you and then after that copy from excel and paste to your IDE.
Sample: Try to copy Syntax code from http://stackoverflow.com/questions/1404513/random-background-image-for-div page, and paste into notepad or IDE. It will become a single line of code.
But if you will copy and paste into excel and again copy from excel than paste into notepad or IDE than if will come into multiple lines with indentation.

Enjoy your Green Code @ code4green.com