Thursday, April 19, 2012

VHD conversion to VMWare Image

Recently I wanted to install the SharePoint 2010 IW Hyper-V Image.I have downloaded the full software packed vhd format from the Microsoft site to be used on my Windows 2008 R2 trial version installed desktop. I wanted this package on my laptop too.Installed Windows 7 32bit OS. Initially I thought this will be easy to convert the .vhd file into VMWare image file format.vmdk.But later there I need to download the converter tool from VMWare site.It was about 108MB in size.After downloading this file I started to convert. You must have your Virtual Server is ON from this it will created the VMWare supporting format.Even one of my colleague tried to convert the "Remote Server" as vmdk format.It showed the dialog which says this tool must be installed on Remote server too. For security reason,We could not do this. After so long search,I found the simple and powerful tool "WinImage". Learn more about this tool from this link .vhd to vmdk Converter

Wednesday, April 18, 2012

Taxonomy Simple talk

Taxonomy in SharePoint 2010 is a new topic to organize and index the contents based on certain hierarchical group based. Put it in simple word,How the supermarket organizing the products categorically to easy access by the customers. By categorize the products by apartment wise,floor wise and rack wise. In SharePoint provide this logical approach by using the "Managed Metadata Services". SP object model gives the hierarchical view of the terms such as Session,Store,Group,TermSet and Terms. On site capacity plan,Let assume we have a site for Tax Managing department for a corporate.Every time the users from the tax department uploads the document for collaborate and process for taxation,they needed a reliable mechanism to manage them in organized manner. Suppose they wanted to search document,they can easily do it by supplying the keywords like "Sales tax 2011".Search will quickly returns the document. Even though there were types of law related document stored in document library,It simply returns the relevant document. So the term or keyword "Sales tax 2011" will be stored as Term in Managed Metadata service.We consume this from our site by placing the new column type "Managed Metadata". Like taxonomy we have another fancy word folksonomy.This is nothing but user generated keywords when they uploading the document or record to be identified quickly.Example "Tag clouds". Lastly,Taxonomy is nothing but "Classifying the information[contents] through hierarchical based approach".

Saturday, April 14, 2012

WCF Hosting in SharePoint environment

Creating the WCF service and consuming in SharePoint application is now improved.Later version we need to create the WCF service and hosting it in IIS server as stand alone application. From this we need to create the "Proxy Class" using the tool wsdl or svcutility to be used on client application. But this approach will not be so user friendly when it comes to SharePoint. Again the hosting endpoint is the static one. Maintainability and back up of the webapplication or service application in SharePoint is must not be complex. Recent improvement has been done in WCF using Factory method.This will get rid of the static end point problem.It automatically set the dynamic end point in run time. Create the SharePoint empty project. Select the "SharePoint Mapped" folder. Under ISAPI folder you'll the folder.Inside this folder create the "text file or xml file". Copy the below line in to this txt or xml file.
<%@ServiceHost Language="C#" Debug="true"
    Service="WCFHosting.Layouts.WCFHosting.ListService, $SharePoint.Project.AssemblyFullName$"
    Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Rename this file's extension as .svc Under the same folder create the code file type "Interface" and implement all the methods on the same file. For simplicity I created the below class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Runtime.Serialization;
using Microsoft.SharePoint.Client.Services;
using System.ServiceModel.Activation;

namespace WCFHosting.Layouts.WCFHosting
{
    [ServiceContract]
    interface ServiceInterface
    {
        [OperationContract]
        List GetAllRecords();
    }
    [BasicHttpBindingServiceMetadataExchangeEndpointAttribute]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class ListService:ServiceInterface
    {
        
        public List GetAllRecords()
        {
            List obj = new List();
            SPListRecord record = new SPListRecord();
            record.title = "SP"; record.name = "Pandian"; record.city= "Mumbai";
            obj.Add(record);
            return obj;
           
        }
    }
}
public class SPListRecord
{
    public string title{get;set;}
    public string city {get;set;}
    public string name{get;set;}

}
Now we need to do important step to enable dynamic endpoint by sharepoint. Now right click on your "Project" and choose the "Unload project".Edit the Project file(.csproj). Inside the PropertyGroup place this tag
    svc
Now reload your WCF project,rebuild and deploy it. Now we have the full pledged and SharePoint compatible WCF service and it can be host anywhere in the Farm and it can be consumed in Application Page,Visual WebPart and InfoPath forms.

Wednesday, April 11, 2012

REST Web Service in InfoPath 2010

This blog will be underline the verily basic step needed to consume the REST Web service in Info Path 2010. Here I have created the WCF Service using Factory method.There will not be the endpoint config entries.I just removed all the config entries in this WCF application. On service file(.svc) used the Factory="System.ServiceModel.Activation.WebServiceHostFactory" in the markup view. Download the Microsoft.Http.dll and Microsoft.Http.Extension.dll from the Microsoft site. I have two method to retrieve the single record and one is for multiple records. WCF interface implementation code
sing System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using Microsoft.Http;
using System.ServiceModel.Web;
using System.Text;

namespace RestWCF
{
   
    [ServiceContract]
    public interface RestWCFInfoPathCalculator
    {

       
        [OperationContract(Name = "SomeValue")]
        [WebGet(UriTemplate = "/GetAllDetails")]
        List GetAllDetails();

        [OperationContract(Name = "GetBillValueByInv")]
        [WebGet(UriTemplate = "/GetBillValue")]
        BillDetails GetBillValueByInv();
        
    }
    [DataContract]
    public class BillDetails
    {
        [DataMember]
        public string InvoiceNumber;
        [DataMember]
        public double InvoiceAmount;
        [DataMember]
        public DateTime InvoiceDate;
    }
  
}
Interface code implementation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace RestWCF
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : RestWCFInfoPathCalculator
    {
       
       public BillDetails GetBillValueByInv()
        {
           return GetAllDetails().FirstOrDefault(c => c.InvoiceNumber == "2");
      
        }
       public List GetAllDetails()
       {
           List list = new List();
           list.Add(new BillDetails { InvoiceNumber = "2", InvoiceDate = Convert.ToDateTime("12/03/2012"), InvoiceAmount = 34343.45 });
           list.Add(new BillDetails { InvoiceNumber = "3", InvoiceDate = Convert.ToDateTime("08/03/2012"), InvoiceAmount = 6457.7 });
           return list;
           }
    }
}

Host this WCF service in IIS.Video to help you on this [http://www.youtube.com/watch?v=iptFJaeJ-F0] Now open your InfoPath Designer 2010 - > select the "Blank" form template On Ribbon select the "Data" tab and click on "Data Connection" follow the screenshot.
Infopath Output.

Monday, April 09, 2012

Where is the love for InfoPath

One of the best blog over the Info path and its development aspects,I came across this blog. where-is-the-love-for-infopath It almost speak the real time development issues by most of the MVPs and not just pros and cons some of the blog entry those without going actual experimental. An year ago,I was part of the team to develop the complex custom workflow using visual studio.At initial point we used the merely "approve/reject" option.Later the requirement need to incorporate to capture the "Life Cycle" of multiple workflow those are attached into document library,and wanted to use "Managed Meta Data" on all the user's comment and ratings over the document. we shocked and stalled whether these are possible in Info Path. Moreover,Configuring the info path for client side also is not easiest one.Every time we ended up with strange error. Some point,we could not identify the actual errors on Logs either Windows Event log. Cost issue also raised on that time,Client was very conscious on budget at one point they are not ready to go single license to adopt the Info Path strategy. So we withdrawn the Info Path form development and put placed Custom ASPX form with all requirement that almost replicate the info path's layout/rules/action and enhanced rich features on the "Approval/Reject Form". But I still love the info path where you don't need high complex business logic to be applied and ready to limiting the features to adopt Info Path.

Sunday, April 08, 2012

Spicy matter

Now i am wainting to board spicejet from madurai to mumbai.
I am very fond of spicy masala from my wife's hometown.Here in Mumbai I used to put the readily available and packaged masala on mutton.I end up unsatisfactory dinner.This time,my wife prepared the handmade and exactly mixature of the masala.Actually i forgot and boarded the bus to airport. when computer scanned my bag,I was told to come otherside to openup the bag.First moment I really shocked and security cop asked me "what  was inside my package". I simply replied
a couple of SharePoint related books and an book titled Cloud computing on SharePoint.He again insisted me that I had any food items to have on board.I smiled at him and continue my coversion with him in Hindi.
I remembered after Few minutes thai i had 2 packages of coriander powder and red chilli powder.Despite I aware of these stuffs are not allowed pn board ,i simply forgot.They cancelled my boarding pass and asked me to put my bag in luckage and made new boarding pass.Today this flight was late by one hour.:)-

Saturday, April 07, 2012

SharePoint content databases

configuration db:
This db contains informations about the sharepoint databases,iis websites and web applications,trusted solutions,web part packages,site templates and farm settings of sharepoint farm settings.This must be reside on where the Central Administration content database residing.This is read-heavy database once production begins.

Content db:
this contains all of the site contents like lists,libraries,properties of webparts,audit logs,user names and their rightes on the site.It can contain multiple sites or single site.If single database larger than microsoft recommended limitaion 200GB then storage must be carefully consider.Sql enterprise edition's table partioning could be used.Part of databases can be reside different RAID array.

Property
Crawl
Search Administration
Web analytics reporting
Web analytics staging
Profile
Synchronization
Usage
Business  connectivity Database
Application Registry
Subscription settings
Social tagging
Secure store
Word automation services AND performance point.

Wednesday, April 04, 2012

Outlook appointment using EWS API

Recently I developed the small utility to send the outlook based appointment invitation using Exchange Web Service Managed API. You need to download the file "EwsManagedApi.msi"[786KB] from this link EWS Managed API download link Add the Microsoft.Exchange.WebServices.dll to your project and include the namespace Microsoft.Exchange.WebService.Data Always exchange server protected through SSL,you need to validate the certificate for trusted relationship with your client application.
        ExchangeService service = new ExchangeService();
        service.Credentials = new WebCredentials("UserName", "Passw0$rd", "Domain");
        service.Url = new Uri("https://owa.yourDomain/EWS/Exchange.asmx");

        System.Net.ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
        //Response.Write(service.RequestedServerVersion);
        Appointment appointment = new Appointment(service);
        appointment.Subject = "EWS Managed API hooked";
        appointment.Body = "Discuss over Exchange Web Service API";
        appointment.Start = new DateTime(2012, 7, 20, 10, 00, 00);
        appointment.End = appointment.Start.AddHours(1);
        appointment.RequiredAttendees.Add("emailID");
      
When I am adding this Web Service URL to my visual studio project,It required my login credentials for this domain.Interesting point I've found on this,my client certificate got expired.To suppress this I simply change boolean value on the CertificateValidationCallback method. First moment I am not aware of my WebService URL.I put the debug mode on Autodiscover method,It listing out my webservice URL for the Exchange Server 2010.
Validating the X509 certificate
private static bool CertificateValidationCallBack(
        object sender,
        System.Security.Cryptography.X509Certificates.X509Certificate certificate,
        System.Security.Cryptography.X509Certificates.X509Chain chain,
        System.Net.Security.SslPolicyErrors sslPolicyErrors)
    {
        // If the certificate is a valid, signed certificate, return true.
        if (sslPolicyErrors == System.Net.Security.SslPolicyErrors.None)
        {
            return true;
        }

        // If there are errors in the certificate chain, look at each error to determine the cause.
        if ((sslPolicyErrors & System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors) != 0)
        {
            if (chain != null && chain.ChainStatus != null)
            {
                foreach (System.Security.Cryptography.X509Certificates.X509ChainStatus status in chain.ChainStatus)
                {
                    if ((certificate.Subject == certificate.Issuer) &&
                       (status.Status == System.Security.Cryptography.X509Certificates.X509ChainStatusFlags.UntrustedRoot))
                    {
                        // Self-signed certificates with an untrusted root are valid. 
                        continue;
                    }
                    else
                    {
                        if (status.Status != System.Security.Cryptography.X509Certificates.X509ChainStatusFlags.NoError)
                        {
                            // If there are any other errors in the certificate chain, the certificate is invalid,
                            // so the method returns false.
                            return true;
                        }
                    }
                }
            }

            // When processing reaches this line, the only errors in the certificate chain are 
            // untrusted root errors for self-signed certificates. These certificates are valid
            // for default Exchange server installations, so return true.
            return true;
        }
        else
        {
            // In all other cases, return false.
            return false;
        }
    }
Few line of codes really useful for certain situation. The one EmailMessage class is the simplest and hassle free when comparing with System.Net.WebMail and SMTP configuration based email.
   //EmailMessage message = new EmailMessage(service);
        //message.Subject = "EWS Managed API";
        //message.Body = "The proposition has been considered.";
        //message.ToRecipients.Add("email Address");
        //message.SendAndSaveCopy();

        //Response.Write("Sent");

Sunday, April 01, 2012

Nintex First WorkFlow

To download the Nintex Workflow 2010 you must provide your web email address,they will not accept if you provide any of the public email address such as Yahoo,gmail and hotmail. You will get the download link along with .nlf file which is mandatory to activate the product. After downloading this .msi file and installed,You need to deploy the solutions nintexlivecore.wsp and nintexworkflow2010.wsp through your Central Administration. Apart from these you need to configure the mandatory settings like "Content Database,managed allow path,and webapplication activation. I made it a very simple Approval workflow and found lot of features those are not available in SharePoint 2010 out of box workflow. "Delegating the task to someone" is a really nice feature in Nintex workflow.Later I will explore all the enchanced features in this workflow.
Leave approval Process workflow.