Aswath’s Blog

Idea away with wings..

SharePoint 2010 Technical Preview – Developer Document

Posted by aswath on July 26, 2009

A eagerly waiting of New Robot from Microsoft is coming to Roads soon in the form of Sharepoint2010 . being said that i have couple of  links to Realted to SharePoint 2010 Developer Document.

Lots of interesting information, enjoy!

Posted in Sharepoint 14 | Leave a Comment »

Microsoft Mythbusters: Top 10 VMware Myths

Posted by aswath on July 26, 2009

Quick  top 10 myths from VMWare. Here’s a quick outline of the topics discussed during the 11 minute video:

  • Live migration?
  • clustered shared volumes?
  • Hyper-V scalability
  • Hyper-V performance
  • Hyper-V footprint
  • Hardware support
  • Memory overcommit
  • End-to-end management
  • Value
  • Why pay VMWare’s virtualization tax
  • Microsoft Mythbusters: Top 10 VMware Myths

    Posted in 1 | Leave a Comment »

    Reduce to bare bones of SharePoint debugging by creating the snagexecution toolbox

    Posted by aswath on April 21, 2009

    Introduction

    This series of Article is intended to help you getting ramped up with SharePoint programming. It’s about writing, troubleshooting and debugging SharePoint code. First you need to have prerequisite skills in .NET Development and in particular ASP.NET Development, you should also have basic understanding of SharePoint and how to use it from the User Interface , you must be able to create and deploy features and you should have some experience in working with content types and site columns.

    Ready? Let’s get started!

    The terms “Bug” and “Debugging” are facts of a programmer’s life. Debugging in general is a lengthy and tiresome task. In my mind, for you to be a good SharePoint developer, you must know how to troubleshoot your applications. The trick is SharePoint debugging can be quite complex for those who are new to the platform, that’s why I decided to kick off my series of article with how to simplify Debugging SharePoint code before we dive deep into the world of SharePoint programming. At the end of the article we’ll create the “SharePoint troubleshooting toolbox” that we’ll frequently use in our series “Getting Started to SharePoint Programming“.

    Simplifying SharePoint Debugging By Creating The Troubleshooting Toolbox

    Debugging in WSS or MOSS is similar to debugging an ASP.NET application but unfortunately debugging custom code in SharePoint isn’t as easy as just pressing F5 from inside Visual studio. While SharePoint provides an excellent platform for developing Web applications, debugging them can be a bit of a pain. In this article I will give you some debugging tips that could make your life easier and will help you deal with the silly “An unexpected error has occurred” screens. Also I will shed the light on some tools provided by the SharePoint community that facilitate the troubleshooting of SharePoint applications and error isolation and accordingly increasing your productivity.

    Five main resources are available for you when you experience a problem:

    1. Detailed Error Messages

    2. Attaching the Visual Studio Debugger to W3WP.EXE

    3. SharePoint Trace Logs

    4. Windows Event Logs

    5. Debug And Trace

    1. Detailed Error Messages Vs. The Annoying Page!

    Usually, an error message will be your first indication that something went wrong. Unfortunately, SharePoint uses a user friendly (Yellow & Blue) error page to show that a problem occurred. Yeah, they call it the user friendly page, but we, as developers, call it the Annoying Page. The first time I wrote SharePoint code, I received a screen like the one shown in the figure below:

     

     

     

    spmag131

    This error page points out that an assembly has thrown an unhandled System.Exception. Sometimes, the user-friendly error page will specify the nature of the error if the code that threw the exception used something more specific than System.Exception or if it included a message in the Exception class constructor.

    We need to get a more detailed Error Message than the annoying “Unexpected error has occurred “. This can be achieved by doing three modifications to the Web.Config file from the virtual directory containing your SharePoint application. These modifications are listed in the in below table.

    This error page points out that an assembly has thrown an unhandled System.Exception. Sometimes, the user-friendly error page will specify the nature of the error if the code that threw the exception used something more specific than System.Exception or if it included a message in the Exception class constructor.

    We need to get a more detailed Error Message than the annoying “Unexpected error has occurred “. This can be achieved by doing three modifications to the Web.Config file from the virtual directory containing your SharePoint application. These modifications are listed in the in below table.

    Tag Name Attribute Default Value Updated Value
    customErrors mode On

    <customErrors mode=” On” />

    Off (or) Remote Only

    <customErrors mode=” Off” />

    SafeMode CallStack False

    <SafeMode CallStack=”false” />

    True

    <SafeMode CallStack=”true” />

    SafeMode AllowPageLevelTrace False

    <SafeMode AllowPageLevelTrace=”false”

    True

    <SafeMode AllowPageLevelTrace=”false”

    compilation debug False

    <compilation batch=”false” debug=”false”>

    True

    <compilation batch=”false” debug=”true”>

    No Custom Errors shows the full error to every client, every time. This is typically used Development environment, since there are no clients using it.

    Remote-Only Custom Errors allow you to display custom errors only to remote clients. This means that if you are browsing your SharePoint site locally, you will get the fully detailed error messages. However, anybody else will receive the standard SharePoint page.

    I recommend using the Debug Config feature to automate this process. This is just a feature that when you activate on a web application, it automatically tweaks the Web.Config of the specified web application across the farm.

    2. Attaching the Visual Studio Debugger to W3WP.EXE

    Now you have the standard ASP.NET error page with a stack trace , OK this is very helpful but you don’t want to guess what the problem might be and randomly change your code to fix it.

    First thing you need to do to avoid the old fashioned trial and error technique is to enable debugging. This could be achieved by setting the compilation element debug attribute to true in Web.Config from the virtual directory containing your SharePoint application, otherwise, breakpoints inside Visual Studio will be shown but will never be used.

    Once you’ve done that, there is one more thing you need to do in order to be able to debug your SharePoint code in Visual studio which is attaching a debugger to W3WP.EXE, Attaching a debugger in Visual Studio will allow you to step through the code and find exactly where the error occurs.

    spmag22

    spmag3

    It’s really handy but there are three questions that I always receive from my colleagues when they get started to SharePoint programming, so I decided to share the answers with you.spmag10

    The first one is: Sometimes, I set breakpoints and attach to the process but Visual Studio skips loading the symbols if I’m debugging a deployed assembly to the GAC and I fail to debug the code

    Easy, Open Tools -> Options -> Debugging.

     

     

    You’ll find an option labeled Enable Just My Code (Managed Only) as shown in the figure which is checked by default. Uncheck this option to be able to debug the assemblies located in the GAC. There is a common myth among .NET developers in general and especially SharePoint ones, that in order to debug assemblies that have been deployed to the GAC, you need to copy the debug symbols (PDB File) to the GAC as well. This was true in the early days of .NET but this is no longer true.

    The second one is: When I try to attach the debugger to the W3WP.exe process to debug, I always see multiple instances of it. Which one should I attach to?

    Ok, this is easy too. Just follow the following steps.

    • Open the command prompt window, run IISAPP to get a list of the current instances of W3WP.exe.

    spmag_cmd

    • Note the PID of the instance that corresponds to your web application.
    • Now return to VS, select Debug -> Attach to process and attach to the W3wp.exe instance with an ID equivalent to the PID you got in step 2 -> click Attach.
    • Now you can trace through the code and find the error causes easily.

    But the question still remains, why sometimes are they more than one w3wp.exe instance? This is because the SharePoint Administration Site Collection and the SSP Administration site always have their own Application pools for error isolation purposes.

    And the third question is : Is it possible to debug Inline code blocks ?

    Actually, I hate Inline Code Blocks and it’s really a good practice to avoid it due to the performance issues when the JIT compiler compiles them but YES, you can do that.

    So now you knew the process of debugging? Very boring and repetitive huh? Hmm, Can’t that be automated?
    Fortunately Jonathan Dibble, a brilliant developer, created a very handy “Debugger Feature” that can be installed and activated on a SharePoint site to automate this process. Once activated, the Debugger Feature adds an “Attach Debugger” menu item to the Site Actions menu. Extremely helpful and faster than doing that from visual studio.

    spmag6

    3 .Unified Logging Services (SharePoint Trace Logs)

    Sometimes you receive error screens while activating a feature or creating a Site Collection or during deploying packages. For instance, a couple of months ago I got an annoying error “File not found” when creating a site collection from a custom template!

    SharePoint trace logs are at your disposal when you need to troubleshoot errors occurring before and after custom code; they are very useful in the deployment and provisioning operations as they are the main sources of information about everything happening inside SharePoint.

    Most of SharePoint components use the Unified Logging Services (ULS), those logs are normal text files and you can find them in the 12 hive at 12\Logs. You can tweak the ULS settings via the Diagnostic logging link under Logging and Reporting in the operations section of SharePoint central administration to control the verbosity of events captured in the Log files, you can modify the settings per category or for all the categories as shown in the figure; thus modifying the number of events captured. The list entries are sorted in order from most-critical to least-critical. I always just set all of the categories to verbose because it’s sometimes difficult to specify the categories needed to be changed when a problem occurs.

    spmag7

    If you want to tweak the verbosity setting per category, make sure to leave the default value of the General category for trace logging as it is (Verbose) because entries about the provisioning and deployment processes are logged under the General category. Also be aware that updating all categories will make you lose the changes you made to individual ones.

    When you choose to increase the number of events captured by the ULS, you will find the log files very cluttered and hard to use, and SharePoint provides no built-in viewer. To fill the gap and facilitate troubleshooting, free third-party tools exist like LogViewer, SPTraceView and WSS/MOSS Log File Reader .Some utilities including SPTraceView will aggregate log data from more than one server in the farm.

    Below figure shows LogViewer in action.

    I’d also like to point out that you can write code that incorporates logging to MOSS logs. Writing to the same trace log alleviates the need for developers to log their development information in other places such as the Windows Event Log, which is more commonly used by system administrators.

    spmag8

    try{

          //  SPSite site =SPContext.Current.Site;

     

        }

            catch(Exception ex){

            Microsoft.Office.Server.Diagnostics.PortalLog.LogString(“Exception Happened : {0} –> {1}”,ex.Message,ex.StackTrace);

            //throw new SPException(“Unknown Error Occured. Please Contact the administrator

        }

     

    The only limitation to using the code snippet above is that you cannot set the log event level (e.g. low, medium, and critical) as it’ll always display the error level in the trace logs as High. The logger is located in 12\ISAPI \Microsoft.Office.Server.dll and therefore it’s only available with the MOSS install, not WSS 3.0.

    What if you need to write into SharePoint trace logs while having full control on the error level? This is a pretty easy thing to do, because MSDN has a wonderful sample of code that you can reuse. I always use this code in my features.

    Simply add the class to your project and then you can write to the logs using something like the following code.

    TraceProvider.RegisterTraceProvider();
    TraceProvider.WriteTrace(TraceProvider.TagFromString(”XXXX (must be 4 letter tag)”), TraceProvider.StringToSeverity(”Exception or Information”), Guid.NewGuid(), “Method Name”, “Assembly Name”, “Project Name”, “Message”);
    TraceProvider.UnregisterTraceProvider();

    4 . Windows Event Logs

    You should include Windows Event Logs as part of your normal troubleshooting because it sometimes contains useful entries that SharePoint is unable to log via ULS. You can increase and decrease logging by severity level in the same way you do for ULS.

    It’s possible to log errors to the system event log from your custom code but you need to promote the privileges as shown.

        try{

          //  SPSite site =SPContext.Current.Site;

     

        }

            catch(Exception ex){

            SPSecurity.RunWithElevatedPriviliges(

            delegate{

            System.Diagnostics.EventLog.WriteEntry

                (“Your Webpart/Feature Name”,

                “Exception in yourfunction(): “+ex.Message+

                “Stack Trace :”+ex.StackTrace,

                ,EventLogEntryType.Error);

     

        }

            );

           // Microsoft.Office.Server.Diagnostics.PortalLog.LogString(“Exception Happened : {0} –> {1}”,ex.Message,ex.StackTrace);

            //throw new SPException(“Unknown Error Occured. Please Contact the administrator

        }

     

    5. Debug and Trace

    After you take your SharePoint site live, you are not the only one who is using it anymore (hopefully), so you need effective plans to track down errors.

    System.Diagnostics.Debug and Trace statements are very useful in this case. Used in conjunction with DebugView you can determine what has gone wrong! Debug Calls are removed from the release builds, so you should use them in your development environment but Trace Calls remain in release code and so will add an overhead to the code execution yet they are very helpful when you cannot attach a debugger (for instance on the staging or the production environments) . Since manually adding trace calls might be time consuming, I would strongly recommend using a tool such as ReSharper to drop in these statements quickly rather than relying on typing or copy/paste. The next figure shows the trace output usingDebugView.

    spmag9

    SharePoint SnagExecution Toolbox!

    Well, let’s create our debugging toolbox, the following utilities should be included in our SharePoint debugging toolbox; we’ll certainly need them in our long journey with SharePoint development.

    Summary

    This article hat will help you getting started with SharePoint programming and troubleshooting utilities and tools that can really make your life easier before getting our hands dirty with SharePoint code since troubleshooting can really be a nightmare for those who are new to the platform.

    Posted in Sharepoint General | Leave a Comment »

    About Feature Elements

    Posted by aswath on April 18, 2009

    Feature is one of the roubust way to eliminate complexity,versioning, inconsistency.

    Feature Snippet:

    <Feature

    Id=”ud34C3075-X5C0-CD#6-9XCF-CA6BBC7D43″

    ActivateOnDefault = “TRUE” | “FALSE”

    Title=”Location Services”

    Description=”……”

    Scope=”Web/Site/WebApplication/Farm“>

    <ActivationDependencies>

    <ActivationDependency

    FeatureId=”al94C3075-X5C0-CD#6-9XCF-4T6BBC7DA5″ />

    </ActivationDependencies>

    <ElementManifests>

    <ElementManifest

    Location=”Location\LocationPart.xml”/>

    <ElementManifest

    Location=”CustomerLocation\CustomerLocationList.xml”/>

    <ElementFile

    Location=”test.aspx”/>

    </ElementManifests>

    </Feature>

    ActivateOnDefault

    Optional Boolean. TRUE if the Feature is activated by default during installation or when a Web application is created; FALSE if the Feature is not activated. This attribute equals TRUE by default. The ActivateOnDefault attribute does not apply to site collection (Site) or Web site (Web) scoped Features.


    In general, Farm-scoped Features become activated during installation, and when a new Web application is created, all installed Web application-scoped Features in it become activated.


    Scope :

    Feature one can set scope at the individual Web site level.

    A site collection Feature contains items that apply to the site collection

    as a whole (e.g.,content types that are shared across the site collection),

    as well as items that can be activated per site.


    Site Collection or Site scope include list definitions

    (templates and instances), modules (file sets), and item content type behaviors

    (per-item custom menu options and per-item events).


    Web (Web site scope)


    Control,Custom Action,Custom Action Group,Hide Custom Action,List Instance, List Template,Module,Receiver


    Site (site collection)


    Content Type,Content Type Binding,Control,Custom Action

    Custom Action Group,Feature/Site Template Association,Field

    Hide Custom Action,List Instance,Module,Workflow


    WebApplication (Web application)


    Control,Custom Action,Custom Action Group,Document Converter

    Feature/Site Template Association,Hide Custom Action


    Farm (farm)


    Control,Custom Action,Custom Action Group,Feature/Site Template Association,Hide Custom Action


    ActivationDependency

    Features can have dependencies on other Features, and these other Features can be activated when the Feature that depends on them is activated.


    Note : Windows SharePoint Services does not support a cross-scope activation dependency if the current Feature depends upon another Feature at a more restrictive scope, or if the current Feature depends on a hidden Feature. Click here


    ElementManifest : Definition for a feature element


    ElementFile : Support file required for the Feature this may contain


    master pages, page layouts, images, style sheets etc


    Click here


    Feature that provisions the instances does not remove the instances upon deactivation.


    Provision a File : the Module element within a Feature or site definition. The Module element allows you to add one or more files, or file set, to a SharePoint Web site or document library.


    Type=”GhostableInLibrary”


    This setting tells Windows SharePoint Services to create a list item to go with your file when it is added to the library


    Type=”Ghostable”


    Provisioning a file outside a document library.

    Posted in Sharepoint General | Leave a Comment »

    Make sure web part pages instance created with side navigation

    Posted by aswath on April 16, 2009

    Problem:
    When you create a new Web Part Page in SharePoint, it is created without left side navigation (or right side if you use rtl version).
    The page’s layout and design are all inherited from the master page, and shown correctly, but the side navigation is not.

    page1

    Cause:
    The left side navigation is defined in the Master Page, in the “PlaceHolderLeftNavBar” content place holder.
    The templates for Web Part Pages shipped with SharePoint are overriding this content place holder and delete its content.

    Solution:

    Modify the page so it will not override the menu place holder, but inherite it from the Master Page. The place holders we are interested in are:
    “PlaceHolderLeftNavBar” and “PlaceHolderNavSpacer”. The first one actually contains the menu control, and the last one reserves some width to maintain proportions.

    Open SharePoint Designer.
    Open the web part page you want to add the menu to.
    In Code view – Look for the following lines and delete them:
    <asp:Content ContentPlaceHolderId=”PlaceHolderLeftNavBar” runat=”server”></asp:Content>
    and
    <asp:Content ContentPlaceHolderId=”PlaceHolderNavSpacer” runat=”server”></asp:Content>
    Save the file. SPD will warn you that you are about to customize the page. Confirm the warning.

    page2

    There are some other options to handle this without customizing the page, like adding another web part zone layout to the web part page creation page. These are not covered here.

    Result:
    Here is the result

    page3

    Posted in Sahrepoint Tips | Leave a Comment »

    oops ! Missing Create or extend Web application

    Posted by aswath on April 14, 2009

    Recently I wanted to create a new web application in SharePoint and so I went to the Central Admin website to create one, but the option was missing. Even though I was logged in as the System Account, the farm administration account I couldn’t see the link. If I navigated directly to /_admin/extendvs.aspx I got an access denied message and none of the accounts configured for SharePoint would allow me access.

    image_thumb_1

    So after a lot of head scratching I remembered that I had navigated directly to the administration site directly in an existing browser session and had not used the link from Start Menu. As soon as I navigated from the start menu I realized that I  was using Windows Server 2008 and that Central Admin has to be run with administrator (or)service account privileges.

    Posted in Sharepoint Administration | Leave a Comment »

    STSADM MergeContentDB Pitfall & work Around

    Posted by aswath on April 14, 2009

    Hi i have come across good useful stuff talk about best practice of merging sharepoint contentDB

    Under certain circumstances, the STSADM MergeContentDB command may fail in Windows SharePoint Services 3.0. These circumstances include combinations of significant site collection size, user traffic, and SQL Server load. When the STSADM MergeContentDB command fails, both the source and destination databases can be corrupted.

    This issue may occur when you use the STSADM MergeContentDB command on a Site Collection that is larger than 10 gigabytes (GB).

    To work around this issue, you have to follow the below actions when you use the STSADM MergeContentDB command:

    • Always back up the source and target databases before you use the STSADM MergeContentDB command.
    • Set the site collection to be read-only before you use the STSADM MergeContentDBcommand to move it. The following is an example:

    ·         stsadm -o setsitelock -url http://server_name/sites/site_name -lock readonly

    Setsitelock: Stsadm operation, visit the following Microsoft Web site

    • Refrain from canceling the operation on the front-end Web server or on the server that is running SQL Server.
    • Run the STSADM MergeContentDB command during off-peak hours because theSTSADM MergeContentDB command places significant additional load on the server that is running SQL Server.

    (OR)

    ·         consider using Batch Site Manager and the method that is described in the “Move site collections

                Ref: http://technet.microsoft.com/en-us/library/cc508854.aspx

    ·         Because the Batch Site Manager works with site collections by using the STSADM backup and restore operations with the –url parameter, but practice recommends that donot use Batch Site Manager for site collections that are larger than 15 GB.

     

     

    Posted in STSADM | Leave a Comment »

    Sharepoint Designer is now free!

    Posted by aswath on April 14, 2009

    Late to this game, as usual but still adding here.

    Today I am excited to share with you some news about SharePoint Designer 2007. Starting now (April 2, 2009), SharePoint Designer 2007 will be available as a free download! microsoft want more of you customizing SharePoint and feel that this a good way to put the tool in the hands of more people. You can find a lot more information in microsoft site including:

    a) Letter to our Customers

    b) Frequently Asked Questions

    c) Free Download

    Also, make sure to watch this YouTube video where Tom Rizzo and J.R. Arredondo discuss these changes and provide some insights into what is coming in the future. Or if you prefer to download the video, just pick the appropriate version for your bandwidth in the list below:

    · Small size video (6MB)

    · Medium size video (17 MB)

    · Large size video (83 MB)

     

    I’ve been using SD for customizing our internal site we use to run our processes, it is invaluable tool

    great to go head and start use it….

     

    Posted in Sharepoint General | Leave a Comment »

    What’s New in Sharepoint 14

    Posted by aswath on April 9, 2009

    Good info…

    SharePoint 14 is the next version of Microsoft SharePoint and during the PDC 2008 was revealed about SharePoint 14
    SharePoint 14 will, most certainly, be released at the same time as Office 14 which most probably will be released when Windows 7 around 2010 mid. The guess is that this point in time is in about a year

    Microsoft said that it plans to formally integrate enterprise search technology from its $1.2 billion acquisition of Fast Search and Transfer a year ago into its popular SharePoint content management platform.

    By comparison, the existing search features in Microsoft Office SharePoint Server have trouble handling repositories with more than 50 million documents, Ovum analyst Madan Sheina wrote last month.

    The new FAST Search for SharePoint will also bring “more advanced linguistic capabilities” and “more powerful processing” of both structured and unstructured content, Microsoft’s Andersen said.
    Search Server will become Microsoft’s mid-tier, paid enterprise search software, while Search Server Express remains its low-end, free version.

    Probable changes you may see

    Here are the stuff that I think will most probably be in SharePoint 14, not listed in any special order:

    • A web standards compliant user interface – The web user interface will support the web standards
    • Non-table driven interface – The user interface is not solely based on a table-driven design, but rather a more simple approach using DIVs, which makes it more customizable
    • AJAX based interface – this is one thing that I’m rather confident about being updated
    • .NET 4 based – SharePoint will use the .NET Framework 4. This will also give support for the new WF stuff.
    • No changes to the WebPart classes – I have not seen any changes in the WebPart classes in the .NET 4 beta framework. Making changes to these parts would break current existing SharePoint applications.
    • Developer tools – the Visual Studio extensions for SharePoint will go to version 2 and finally be useful
    • An STSADM GUI – a more user friendly way to work with SharePoint administration. STSADM will still be there for sure, but a user interface (web based or not) that makes it more easy to manage features will probably be there.
    • Licensing – I would not be surprised if we get a new SharePoint edition, such as a SharePoint Publishing Edition, that has a better price level if you just want to use the publishing features of MOSS.
    • Excel Services – MOSS 2007 contained the first version of Excel Services and version 2 will most probably have some really nice enhancements that make Excel Services even more powerful.
    • API changes – the API’s will not change so much that it breaks current applications but rather have some fixes that makes it even better and easier to program against. See my previous post on this.
    • Social Networking and Enterprise 2.0 – the social networking pieces will be taken to another level. What happened to Townsquare?
    • Groove – Groove and SharePoint will now be fully integrated
    • 64-bit only – SharePoint will only be available on 64-bit platforms
    • Other stuff
    • Option to customize the application.master in a better way
    • Tight integration with the new Office Live products
    • FAST Search features out of the box
    • Document standard support: ODF, OOXML, PDF, all ISO approved document formats
    • Silverlight everywhere!
    • Claims based authentication. Easy configuration to use the Geneva Server and Framework for authentication
    • Based on the MVC framework – if this was the case then no one would be happier than me!
    • Installation possible on workstation OS (Vista and Windows 7)

    What’s your take?stay tuneed………

    Posted in Sharepoint 14 | 1 Comment »

    Designing Conference Rooms Reservation Application Template with SharePoint

    Posted by aswath on April 8, 2009

    I had a business Requirement where my users should able to create Meeting Request through SharePoint

    Business Scenario:

    I have set up the Room and Equipment Reservations application template. Some resources are created, for example:

    · Resource Name: Conference Room 1; Resource Type:Conference Room

    · Resource Name: Conference Room 2; Resource Type:Conference Room


    Some of your end-users start creating reservations, for example:

    · Start Date: 24-03-2008 1 PM 00

    · End Date: 24-03-2008 3 PM 30

    · Resource: Conference Room 1,Review Room1,Lotus,


    Those users would like to send out an appointment with Microsoft Outlook right away from within SharePoint, taking into account the data they have already provided upon creation of the reservation in SharePoint.

    The Solution I Approached Goes:

    To achieve this, I combined some of my SharePoint knowledge, with a JavaScript snippet I found on the web written by Brian White.

    As prerequisite for the solution, Microsoft Outlook should be installed on the client machine with which the SharePoint site is being accessed.

    Create a SharePoint custom list  named “OutlookReservation“with the below specified columns,

    fig-1

    Which Some Things Looks like below


    fig-2

    1. Create the MyReservations.aspx page with Microsoft SharePoint Designer 2007. In the SharePoint site.Which should includes web part zone implemented,

    2. Go to Reservation page & go to site Actions and click on Edit Page Add  web part   select Outlook Reservation List  to the page. Which results looks below.

    fig-41

    3. Access the web part Registered page in SharePoint Designer select web part  placeholder

    4. Right-click the ListViewWebPart and choose Convert to XSLT Data View

    5. Right-click the last column of the created grid, and choose Insert -> Column to the Right

    6. Give the column the title Outlook Appointment.

    7. Go to the code view.

    8. Insert right after the PlaceHolderMain tag following code snippet:

    <script type=”text/javascript”>

    function createOutlookAppointment(title,meetinglocation,startdate,enddate)

    {

    newAppt = new appt(title, meetinglocation, formatIncomingDateTime(startdate),

    formatIncomingDateTime(enddate));

    saveAppt( newAppt );

    }

    function formatIncomingDateTime(incomingDateTime){

    var datePart = incomingDateTime.substring(0,10);

    var timePartHours = incomingDateTime.substring(11,13);

    var timePartMinSecs = incomingDateTime.substring(13,16);

    timePartHoursInt = parseInt(timePartHours,10) + 1;

    timePartHours = timePartHoursInt.toString();

    return datePart.concat(‘ ‘.concat(timePartHours).concat(timePartMinSecs));

    }

    function appt( Subject, Location, Start, End){

    this.Subject = Location;

    this.Location = Location;

    this.Start = Start;

    this.End = End;

    this.ReminderMinutesBeforeStart = 15;

    }

    function saveAppt( obj ){

    var olAppointmentItem = 1;

    out = new ActiveXObject( “Outlook.Application” );

    appt = out.CreateItem( olAppointmentItem );

    appt.Subject = obj.Subject;

    appt.Location = obj.Location;

    appt.Start = obj.Start;

    appt.End = obj.End;

    appt.ReminderMinutesBeforeStart = obj.ReminderMinutesBeforeStart;

    appt.Display();

    return null;

    }

    </script>

    9. Go to the <td> tag of your newly created column (search for Reserved By, it will be a couple of lines beneath it).

    10. Add a button which will execute previously created code snippet: <input type=”button” value=”Outlook” onclick=”javascript:createOutlookAppointment(‘{@Title}’,'{@Resource}’,'{@StartTime}’,'{@EndTime}’);return true;”/>

    11.

    fig-5

    As a result the users will have next to each reservation a button.

    fig-6

    12 , Clicking on the button will create a Microsoft Outlook appointment with the data previously entered upon creation of the reservation in Microsoft SharePoint.

    fig-7

    13 . You can extend the Reservations list, by adding additional columns, whose data could be added upon creation of the Microsoft Outlook appointment.

    Posted in Sharepoint Customization | Leave a Comment »

     
    Follow

    Get every new post delivered to your Inbox.