Author Archive

Sharepoint 2010

Friday, October 23rd, 2009

Hello Friends,

      It has been long time since my last post. I am excited about Sharepoint 2010, and waited for this moment to restart my posts. Sharepoint 2010 is out and beta will be available by November 2009. Why should some one get excited about this, because it gives solutions for the problems what you face in MOSS 2007. To list few things out of them

    * Performance (Lists and Libraries can have millions of items inside it)

    * Site Usage details is available for more than 30 days (i think it is available for 365 days and you can customize it)

    * AJAX implementation bring rich UI experience.

    * Well supported for Firefox browser

    * Customizable ribbions (which is replacing contextual menus)

    * Silverlight Integration & Client Object Model (You can play with that like Flash)

    and bunch of new features.. really exciting…
Sharepoint 2010 resources:

http://blogs.msdn.com/sharepoint/

 http://markbower.wordpress.com/2009/10/23/official-sharepoint-2010-and-office-2010-blogs/

http://msdn.microsoft.com/en-us/sharepoint/default.aspx

Satheesh

Deploying the Application pages through Solution file

Thursday, April 17th, 2008

This is the sample Manifest.xml file for deploying a Application Page (layouts page) through the solution file. It is assumed that you know how to create a WSP file.

<Solution SolutionId="540C3653-5A01-4a00-A0FA-2D2203BB3080" xmlns="http://schemas.microsoft.com/sharepoint/">
  <FeatureManifests>
    <FeatureManifest Location="FeatureNameFeature.xml"/>
  </FeatureManifests>
  <Assemblies>
    <Assembly DeploymentTarget ="GlobalAssemblyCache" Location ="Sample.AssemblyName.dll">
      <SafeControls>
        <SafeControl Assembly="AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b51c7c45d52dacb6" Namespace="NameSpace" TypeName="*" Safe ="True"/>
      </SafeControls>
    </Assembly>
  </Assemblies>
  <TemplateFiles>
    <TemplateFile Location ="LAYOUTSSample.aspx"/>
  </TemplateFiles>
</Solution>

 The above example is for a application page with code behind. <SafeControls> entry registers the dll as safe control and puts the dll in GAC. <TemplateFiles> entry puts the aspx page in the Layouts directory. Sameway you can target the others folders in the Template directory.

Satheesh Palaniswamy

Tips about Infopath – Part 1

Thursday, March 13th, 2008

Tips about Infopath 2007

 Here are the few tips on Infopath 2007, which most of the might already aware of. This is just of beginers.

Tip 1: "Unknown error while publishing"

        Sometimes when you try publishing a form you get a Unknown error. And you do all kind of research, still end up without getting a solution. This error most likely to come when you try change a name of a node in datasource which is referenced in one or more conditional formatting.

 Actually i dont have solution for that, it would be better if we always take a backup of working copy, before modifying

Tip 2: Adding new nodes to data sources which is already published

 -> When we add nodes to data sources to a form which is already published, then we need to make a setting change while designing so that all the existing forms will be updated with the new nodes

         -> In the form options -> under versioning select the option "Automatically upgrade existing forms"

 Few more tips in my next post

Document Library and ItemAdding Event

Monday, October 15th, 2007

               In one of our project, we are supposed to lock down the users from creating folders at ROOT in document library. We thought of restricting through event handler. During coding we found that, ItemAdding event doesn't provide enough information to determine where the folder is been added.

              Searching on net, we found that was the bug in MOSS, and Microsoft has provided a hotfix. You can get the Hotfix information in the below URL. It not only solves this problem, but also couple of other bugs, which you can find it in this URL.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;934790

             After installing this hotfix, you will get the AfterUrl property is having the information to determine where the folder/file is been added. But be careful in installing this hotfix, bcose sometimes it might negatively affect your project. We faced a problem of 'Access denied' error message for accessing LOGS folder programmatically. So, testing the hotfix completely in a test environment is mandtory b4 installing on Development/Production machines.

 Satheesh Palaniswamy. 

 

Searching a List using List Web Service and Javascript

Saturday, September 8th, 2007

Hi,

                Some time back, we were trying to do a search on List and show the results in a page. And bcose of the requirement, the default search functionality provided by sharepoint has bcome out of scope. And we don't want to write a custom web part for it, just bcose of installation issues. So, we thought of calling List WebService from JavaScript, parse result and display it. Everything through Content Editor Web Part.

So, what are required to do it from javascript ( SOAP Envelope and AJAX)

Let't see first, how to call the web service from javascript.

var oWebService = new ActiveXObject("Microsoft.XMLHTTP");
oWebService.open("POST", "Web service URL comes here", false);
oWebService.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems");
oWebService.setRequestHeader("Content-Type", "text/xml");
oWebService.send("SOAP envelope");
var responseXML = oWebService.responseText;

Here are the values that we need to pass (Sample values)

Web Service URL
     "http://yoursite/subsite/_vti_bin/Lists.asmx"

SOAP Envelope
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>List Name</listName>
<queryOptions></queryOptions>
<query><Query><Where><Eq><FieldRef Name="Title"/><Value Type="Text">Test</Value></Eq></Where></Query></query>
</GetListItems>
</soap:BOdy>
</soap:Envelope>

That's it. For more details on SOAP Envelope look into the list web service. This code might not work in all browsers. Only one function of List Web Service (GetListItems) is used here. This is just a abstract to give a idea. Hope this is useful.

Regards

Satheesh Palaniswamy.

 

 

ByPass Error Page while canceling the event in Event Handler

Tuesday, August 28th, 2007

          Actually, till some time back, i was searching for a way to bypass the error page, while canceling the event in event handler. In one of our application, when user deletes a item, event handler should cancel event, set a different status (so, that item will not processed in the application anymore). And user should not get the error page, according to the user, item is deleted.

         One of my friend, gave the solution in minutes. Though many of you might already know this, but i think it is worth putting in a blog.  Here is the simple code, which helps us doing that,

                       properties.Cancel = true;

                       properties.Status = SPEventReceiverStatus.CancelNoError;

  That's it, so simple. As most you might know that it works only in synchronous event.

Satheesh palaniswamy

    

Filters in Query String

Friday, August 24th, 2007

       Yesterday, when we are searching on web ( for a different functionality ), we found one interesting article. Here is the requirement, in the home page, user have to search for a item(probably list of items) in a list on meta data selected by the user. We thought of doing it in out-of-box functionality. Here is how we have implemented ( with some drawbacks :) ),

1) Create a Content Editor Web Part,  make free text, drop down list with all meta data names and a button. On Click of the button, through javascript build a URL like this,

 http://yoursite/yourwebpartpage.aspx?FilterField1=<Value from the Drop Down>&FilterValue1=<Value from the text>

use the javascript, for redirecting the page to the URL that we built

window.location.href = "URL like one above"

2) Create a List View Part in the same web part page, from which the items needs to be filtered. You can limit the no of items displayed per page through the view, if you have more items to be displayed.

That's it. Your simple search ready in minutes.

One drawback is that we can't use wild card search (or atleast i haven't found how do that).

Hope this helps.

Satheesh Palaniswamy

Running the event handler code with elevated privilages

Sunday, August 19th, 2007

Lost of us would have created number of event handlers. In situations, we would have implemented most of the application logic in event handlers. That would be like, starting worklfows, setting permissions, adding users to the site etc.,

 Take this example, i have a list, and i have given permission to eveyone to create a item in the list. On creation of item, i have written a event handler, which puts an entry in log list, creates folders in other libraries, where the creator is having only read access on those libraries/list. So, during such situation, event handler might throw exceptions.

 So, how to handle these situations, here comes the solution. We have a SPSecurity.RunWithElevatedPrivileges function which helps us doing this.

 Example

SPSecurity.RunWithElevatedPrivileges(delegate()
            {

              // create objects here and do the operation

});

Satheesh Palaniswamy 

Happy Programming…  :)

How to use MOSS 2007 Out of Box Send Mail function & SPUtility

Monday, August 13th, 2007

Hi,

            Some of us might have encountered situation, where we might have to send mails to the users. But we might not interested in using the .net Send mail functionality (which involves storing the SMTP ip address).  MOSS comes with a namesapce Microsoft.SharePoint.Utilities,  which provides us this functionality.

 Include this namespace in your code.

           using Microsoft.SharePoint.Utilities;

Use this function,

          SPUtility.SendEmail

That's it, as simple as that. You can explore other functions exposed by SPUtility as well.. Happy Programming.

 Regards

Satheesh Palaniswamy