Thursday, April 19, 2012
VHD conversion to VMWare Image
Wednesday, April 18, 2012
Taxonomy Simple talk
Saturday, April 14, 2012
WCF Hosting in SharePoint environment
<%@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] ListNow 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 tagGetAllRecords(); } [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 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.svc
Wednesday, April 11, 2012
REST Web Service in InfoPath 2010
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")] ListInterface code implementationGetAllDetails(); [OperationContract(Name = "GetBillValueByInv")] [WebGet(UriTemplate = "/GetBillValue")] BillDetails GetBillValueByInv(); } [DataContract] public class BillDetails { [DataMember] public string InvoiceNumber; [DataMember] public double InvoiceAmount; [DataMember] public DateTime InvoiceDate; } }
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 ListHost 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.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; } } }
Monday, April 09, 2012
Where is the love for InfoPath
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
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");