Monday, March 29, 2010

InLine List Item Editing in SharePoint 2010

Title: InLine List Item Editing in SharePoint 2010

Details: I have worked on many third party tools including telerik / devexpress and I always wanted the inline editing functionality on atleast the out of the box list items. And finally my wish fulfilled

List items ( on modify view settings ) can now be edited inline as show below.
Before getting to it, you need to first enable the inline editing option as show below on the modify view settings page.

Create a Tool to Get the Full Name of an Assembly

Title: Create a Tool to Get the Full Name of an Assembly

Details: Here is a wonderful way to create a tool to get the full name of an assembly provided by Microsoft ( original link ). Create a command line project and name it as GetAssemblyName using the below code. Below are few screenshots how it looks like ( output ) after you create it.

#1 Adding the tool to the External Tools on your Visual Studio 2010
tools
#2 Linking the Tool
link
#3 Using the tool and output
output

Code:

using System;
using System.Reflection;
using System.IO;

namespace GetAssemblyName
{
class Program
{
static void PrintUsage()
{
Console.WriteLine("Usage: GetAssemblyName.exe \n");
Console.WriteLine(@"Example: GetAssemblyName.exe C:\MyAssembly.dll");
Console.Read();
}

static void Main(string[] args)
{
if (args.Length < 1 || args[0] == "?")
{
PrintUsage();
return;
}

string filename = args[0];

try
{
AssemblyName an = AssemblyName.GetAssemblyName(filename);
Console.WriteLine("Fully specified assembly name:\n");
Console.WriteLine(an.ToString());
}
catch (FileNotFoundException)
{
Console.WriteLine("Cannot locate the assembly. Check the path and try again.");
}

Console.Read();
}
}
}



To add a Get Assembly Full Name item to the Tools menu





  • In Visual Studio, select External Tools from the Tools menu.


  • In the External Tools dialog, click Add and enter Get Assembly Full Name for the Title.


  • Fill the Command textbox by browsing to GetAssemblyName.exe.


  • In the Arguments textbox, type the following (which is case sensitive): $(TargetPath)


  • Enable the Use Output window checkbox. Click OK.


  • The new command is added to the Tools menu.



Technorati Tags: ,

Sunday, March 7, 2010

LINQ to SharePoint

Title: LINQ to SharePoint

Details: Its not new to us that LINQ to SharePoint is newly introduced in SharePoint 2010 with a new Provider 'Microsoft.SharePoint.Linq'. It translates LINQ Queries into CAML queries. Which means... bye bye CAML ( you can still use it if you love it ). Few pointers on LINQ to SharePoint...
  • No CAML required
  • Can be called against both server and client object model
  • Tools available ( SPMetal ) to create business layer ( entity classes ) - How to use SPMetal?
  • Intellisense helps query construction
  • Query across multiple lists with relationships
  • Allow inefficient queries
  • Merge results from multiple lists and multiple data sources
  • Join results from multiple data sources
Code: Sample code on how to use LINQ to SharePoint is as shown below. ( Code run against my custom list called FirstNames which has column name FirstName ). You need to create the entity class ( EntitiesDataContext in the below example ) first using SPMetal that would give a data context for our use.

DataContext data = new DataContext(SPContext.GetContext(this.Context).Web.Url);

using (EntitiesDataContext moEntitiesDataContext = new EntitiesDataContext(SPContext.GetContext(this.Context).Web.Url))
{
    var fn = from fNames in moEntitiesDataContext.FirstNames
            select new { fNames.FirstName };                    
}

Saturday, March 6, 2010

Solution Dependencies in SharePoint 2010

Title: Solution Dependencies in SharePoint 2010

Details: We have seen 'Feature Dependencies' until MOSS 2007. Similarly have you ever felt the need of 'Solution Dependencies'? I am sure you might have felt and then here is how your need is fulfilled in SharePoint 2010. Now we can have solution dependencies and it comes with few rules that we need to understand that are mentioned as below.
  1. Checks if dependant solution is available
  2. Does not deploy dependant solutions
  3. Checks for dependancy during the time of deployment
  4. Solution dependancy works for both kinds of solutions ( Farm / Sandboxed )
  5. Solution dependancy does not work on the combination of Farm / Sandboxed Solutions
  6. In situation when dependancy solution is not activated/deployed then activating/deploying dependant solution will fail.
  7. Opposite the above point # 6 will succeed.
  8. In case of dependancy solution is deactivated/retracted, dependant solution will still be activated/deployed.
Below is sample code on how to use it ( under package.template.xml file )...

Code:
<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
          SolutionId="CURRENT_SOLUTION_GUID"
         <  
  <ActivationDependencies>
    <ActivationDependency SolutionId="DEPENDANT_SOLUTION_GUID"/>
  </ActivationDependencies>
</Solution>

SharePoint 2010 and Office 2010 Lauch dates announced as May 12th 2010

Title: SharePoint 2010 and Office 2010 Lauch dates announced

Details: Mark your calendars as Microsoft announced the launch dates for SharePoint 2010 and Office 2010 as May 12th 2010; official link with details on the SharePoint msdn blog site here.

http://blogs.msdn.com/sharepoint/archive/2010/03/05/sharepoint-2010-office-2010-launch.aspx



Tuesday, March 2, 2010

Error: System.IO.FileNotFoundException was unhandled by user code

Title: Error(s) while running SharePoint 2010 projects using Visual Studio 2010

Details: Have you encountered the below errors while you are running SharePoint 2010 projects using Visual Studio 2010?

System.IO.FileNotFoundException was unhandled by user code
Message="The Web application at http://sp2010/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."

or

Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

Resolution: Verify what framework you are running against. By default Visual Studion 2010 runs with .NET Framework 4.0 and SharePoint 2010 is built against to run on .NET Framework 3.5.
Change you project settings to run against 3.5 and you should be good

Speaking at CapArea SharePoint Group on May 11 2010

Title: Speaking at CapArea SharePoint Group on May 11 2010

Topic: SharePoint 2010 Sandboxed Solutions

Details: CapArea SharePoint Site

Location: AT&T Building, 1900 Gallows Road, Vienna, VA 22182; How to reach here?

Monday, March 1, 2010

Speaking at SharePoint Users Group of DC on Mar 04 2010

Title: Speaking at SharePoint Users Group of DC on Mar 04 2010

Topic: SharePoint 2010 Sandboxed Solutions

Details: Register here

Location: How to reach here?

Speaking at Global SharePoint User Group on Mar 02 2010 ( Online )

Title: Speaking at Global SharePoint User Group on Mar 02 2010 ( Online )

Topic: SharePoint 2010 Sandboxed Solutions

Register: Register here

Link: Other details here

SharePoint 2010 Versioned Controls

Title: SharePoint 2010 Versioned Controls

Details: These are the new control tags introduced in SharePoint 2010 that allow us to render code based on specific version ( V3 or V4 ) for the aspx, ascx and master pages. You can use the below tags and code to achieve it. Use the UIVersion attribute to set the version ( 3 for WSS 3.0 and MOSS; 4 for SPF and SPS 2010 )

Code: During Render ( slower )
<SharePoint:VersionedPlaceHolder runat="server" UIVersion="4">
  <div>Your content</div>
</SharePoint:VersionedPlaceHolder>

Code: During Load Time ( faster )
<SharePoint:VersionedContent runat="server" UIVersion="4">
  <ContentTemplate>
    <div>Your content</div>
  </ContentTemplate>
</SharePoint:VersionedContent >

Migrating from MOSS 2007 to SharePoint 2010

This link is moved here.

Migrating from MOSS 2007 to SharePoint 2010 - Part II

This link is moved here.

Migrating from MOSS 2007 to SharePoint 2010 - Part III

This link is moved here.

Migrating from MOSS 2007 to SharePoint 2010 - Part I

This link is moved here.