Raghu's SharePoint Corner

My blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://www.sharepointcolumn.com
and update your bookmarks.

May 21, 2012

CAML Designer the Next Generation CAML Query Builder for SharePoint 2010

CAML Query builder is the favorite tool of SharePoint Developers. The much awaited CAML Query Builder for SharePoint 2010 is released and its termed as CAML Designer. Karine Bosch’s co-developed this tool with Andy Van.
The newer version of tool is developed using WPF and support only SharePoint 2010. For more details of the tool you can visit here.
Snap Shot

May 8, 2012

SharePoint2010 MAC FBA Authentication Issue

Recently we ran into an issue where Custom Forms Based Authentication was failing on MAC machine. The FBA was configured properly without any issues and is working like charm with Windows OS. Did few searches on Google and found that few of them have faced the issues but in a different scenario and following were the work around or fixes were suggested.

  •       Most of them have either wrongly configured Form Based Authentication and on proper configuration   it started to work.
  •      For few the Claims to Windows Token had stopped, and on restart of the services FBA started working.
  •      Few also suggested the performing an IISRESET on the server solved their issues.
  •     In some case the APP Pool Credentials for Security token services was wrong.


All the above 4 fixes where not valid in my scenario since FBA was working perfectly fine with windows OS.

In order to get to the root cause I had to go through the traditional approach of visiting event viewer and SharePoint logs. On analyzing the event viewer log it was found that the Secure Token Service was not getting generated for the users who were trying to log into the SharePoint 2010 site using FBA from Safari browser on MAC machine.

In order to get more exception details in the event viewer, add the following <serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True"/>   tag in web.config of Security Token Webservices which resides at the following location “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken”

On restarting the services details of the exception was logged as follows.

Event: 8306, SharePoint Foundation
Task Category: Claims Authentication
Exception Details: An exception occurred when trying to issue security token: Object reference not set to an instance of an object.

On seeing this exception we re-visited the Custom Forms Login page which we had created for FBA.  On debug we noticed that the below link threw the above exception
SPClaimsUtility.AuthenticateFormsUser(Context.Request.UrlReferrer,txtusername.Text, txtpassword.Text);

It was certain that the issues was with Context.Request.UrlReferrer passed to the SPClaimsUtility.AuthenticateFormsUser method. In order to get this working we modified the way we were passing URL parameter to the below approach.

string siteUrl = SPContext.Current.Site.Url;
string extraneturl = siteUrl.ToString();
Uri extrametUri = new Uri(extraneturl);
bool status = SPClaimsUtility.AuthenticateFormsUser(extrametUri, txtusername.Text, txtpassword.Text); and FBA started working on MAC.

Hope this post would help anyone facing similar issue. Please feel free to drop any comment or any other alternate approach.

October 26, 2011

Create List item in Folders using Client Object Model

There are scenarios where you would like to add list item to a folder/sub folder in a custom SharePoint list and many of you would like to achieve this using ECMA script/ JavaScript Client Object Model. Before we start with the code, i am assuming that you have enables Folder Content Types in a custom list and have also created a Folder in a list before the below snippet is executed.


function CreateListItemInFolder()
{

// Create client context
 var myContext = new SP.ClientContext.get_current();
 // Get current web (comparable to SPWeb)
 var myWeb = myContext.get_web();
 // Get list by title (comparable to SPList)
   var myList = myWeb.get_lists().getByTitle('Docs');
   // Create new object for list item creation

 //Create List Item Infor and set the Folder Path for the item to be created.      
      var myListItemCreationInfo = new SP.ListItemCreationInformation();
      myListItemCreationInfo.set_folderUrl("http://servername/sites/PP/Blog/Lists/Docs/Folder1");
 var newLinkItem= myList.addItem(myListItemCreationInfo);

     // Set properties for new list item
 newLinkItem.set_item('Title', "Title");
 // Update the new item
 newLinkItem.update();

myContext.executeQueryAsync(Function.createDelegate(this, onSuccessAddQL),Function.createDelegate(this, onFailureAddQL));

}
function onSuccessAddQL(sender, args)
{
alert("Item Added Successfully In the Folder");
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel,'Closing Quick Links Dialog');
}
function onFailureAddQL(sender, args)
{
alert("Item Adding Failed to the Folder");
}

happy coding..

October 3, 2011

Creating Root Site Collection Using Custom Blog Site Template in Office 365

There are scenarios were you would like to use Blog Template (any default site ) or custom site template as the default site template for the Root Site Collection instead of the regular Team Site In Office 365. By default when you subscribe a new Office 365 Subscription you will have team site as default root site collection.

The steps below will guide you to create the root site collection with a custom blog site template. I have created a site using Blog template and created custom list in the site. After you have the necessity structure for the Blog site in place, save the Site as Site Template and download the Blog Template from the Solution gallery to your local PC.

1. Delete the default root site collection of your subscription, by navigating to the admin portal of Office 365. Your Admin portal looks like the screenshot given below.


2. Now click on the new tab and select New-> Private Site Collection, You will get a new New Site Collection PopUp Screen, specify the title of the site, In the Template Selection, click on the Custom tab and select “Select Template Later”, specify the administrator account and Click OK. The screen should look like below

3. Wait for the site to be created, Once the site is created, Navigate to the site, you will see a Template Selection page were you can select the default template as blog for your root site


4. To use custom blog site template, Click on the Solution Gallery, it will take you to the Solution Gallery, upload the custom Blog Site template WSP and activate. After activating the WSP navigate back to the Template Selection Page and you will be able to see a Custom Tab as shown below, select the BlogSite Template and click Ok

                                    

5. Once the site is created it will navigate you the Set Up Groups for the site Page as shown below and click Ok.

In this way you can use any custom site template or change the default site template for your Office 365 SharePoint Online.